From owner-freebsd-current@FreeBSD.ORG Fri Apr 10 09:11:43 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B811860; Fri, 10 Apr 2015 09:11:43 +0000 (UTC) Received: from mail-ig0-x233.google.com (mail-ig0-x233.google.com [IPv6:2607:f8b0:4001:c05::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6E7337A; Fri, 10 Apr 2015 09:11:42 +0000 (UTC) Received: by igblo3 with SMTP id lo3so88019737igb.1; Fri, 10 Apr 2015 02:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=I7TqyoKOQRUQRK6ppyDzhyG6lIyG0ayQV+das+mU3KQ=; b=VWJ33yAz305zP3N30Hy8Aht6aCpqhR1JKRNfK2mtr26JWl4dLK8NFq4LO+hU6uZ4rD PlHHEpZosY2ICk6Nc/yx5ibuWHYAo0tzW7o5ddgNV+O/+61Kounzh9BOSR4wdiMaTThk kUd53dF2G4+YcB09Kgx9E8vq1JWo1JjfOG7BIy7v3pfm1XLOScrP8CDTjPmHGuE/Qqk5 Y7ebJHADNDek/BSjAJeYQHgDQowKWvrW27AVLQ/u2KX/5iu6/NznaTApNqKlqfpHqzSs UGGinWtZd92/exgPRCo7n46pGpjnKZieNWG0PSFt7zP94JyK05Y+sdAiLHKAmjcRRglo dpMg== MIME-Version: 1.0 X-Received: by 10.42.193.69 with SMTP id dt5mr2337871icb.42.1428657102370; Fri, 10 Apr 2015 02:11:42 -0700 (PDT) Received: by 10.64.28.43 with HTTP; Fri, 10 Apr 2015 02:11:42 -0700 (PDT) Date: Fri, 10 Apr 2015 11:11:42 +0200 Message-ID: Subject: [patch] deadlock in vm_reserv_reclaim_contig() From: Svatopluk Kraus To: freebsd-current@freebsd.org, alc@freebsd.org Content-Type: multipart/mixed; boundary=20cf301d426818248105135b27c8 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2015 09:11:43 -0000 --20cf301d426818248105135b27c8 Content-Type: text/plain; charset=UTF-8 Hi, my RPI-B has been stuck in vm_reserv_reclaim_contig() due to a bug within that function. I can reproduce that easily on my two-core pandaboard when I limit all memory in system to 128MiB and run "make -j16 kernel-toolchain". It happens in few seconds. The patch should be self-explanatory. The problem is that there is a free page found in reservation which does not fulfill alignment requirement, thus next free page should be looked for. However, due to the bug, the same free page is found out again and again. The patch takes into account that shift by m on n-bit arch has an undefined behaviour if m >= n. Svatopluk Kraus --20cf301d426818248105135b27c8 Content-Type: text/plain; charset=US-ASCII; name="vm_reserv.diff" Content-Disposition: attachment; filename="vm_reserv.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_i8bdhsa70 SW5kZXg6IHN5cy92bS92bV9yZXNlcnYuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvdm0vdm1fcmVzZXJ2 LmMJKHJldmlzaW9uIDI4MTI5MikKKysrIHN5cy92bS92bV9yZXNlcnYuYwkod29ya2luZyBjb3B5 KQpAQCAtOTgzLDggKzk4MywxMiBAQAogCQkJCWJyZWFrOwogCQkJfSBlbHNlIGlmICgocGEgJiAo YWxpZ25tZW50IC0gMSkpICE9IDAgfHwKIAkJCSAgICAoKHBhIF4gKHBhICsgc2l6ZSAtIDEpKSAm IH4oYm91bmRhcnkgLSAxKSkgIT0gMCkgewotCQkJCS8qIENvbnRpbnVlIHdpdGggdGhpcyByZXNl cnZhdGlvbi4gKi8KLQkJCQloaSA9IGxvOworCQkJCS8qIENvbnRpbnVlIHdpdGggdGhpcyBvciBu ZXh0IHJlc2VydmF0aW9uLiAqLworCQkJCWhpID0gbG8gKyAxOworCQkJCWlmIChoaSA+PSBOQlBP UE1BUCkgeworCQkJCQloaSA9IDA7CisJCQkJCWkrKzsKKwkJCQl9CiAJCQkJY29udGludWU7CiAJ CQl9CiAJCQkvKiBGaW5kIHRoZSBuZXh0IHVzZWQgcGFnZS4gKi8K --20cf301d426818248105135b27c8--