Received: by 10.213.65.68 with SMTP id h4csp1698579imn; Thu, 15 Mar 2018 07:10:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELtskmFSM5jgYQbmgSSKta/+j5NvnxBqb1bbde9EhVKmL2xV13Sf0l5Il+48o1eQKFa2qh9t X-Received: by 10.98.21.200 with SMTP id 191mr7815241pfv.166.1521123023637; Thu, 15 Mar 2018 07:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521123023; cv=none; d=google.com; s=arc-20160816; b=m6r4AkpYsoIcGOM8yTkJm+wo3fIUH+MdUzPf6OoEkxfU8M6Yd2HYR7qrnp9eoWSOQi 5BQhpEJiQVmF91LyyR9LiS94KHcfdLvLwC+qR/Eqmk+iuDA7PJ25tVpIIufcgJ2/5fmU GDTLo9kil6EMER8B8F6AIHYcpcbIonYbazlkC52/EbaeDmpBMJ7y1dxZMM8ms8e/BbAC FmJVc+2t3qm6Wz9KOHAYCKTFp5kLB4TZAtqJPRyuj8dubFmSX0PDiJUFtCiRbd3mjpvK mqzxaMBs0YD40noAJDU6qENEs0tFooc/LdxVZ0iLiOnTgYe6IbM9to+RThFHoYePL0PI IGEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=jPPoUOCZHkGZ2ofFqZZzXJjYdJPCD9SyCuH/Rybxvyw=; b=bt1xCBmoIHi9lwJoNtq12myWEhTf4bQIKSn2PfLtTYoeI06bl7+kxsvra4rin6yM8q vtgoP7T7PIPm24bfednC36DmBy9N3IfThq4+zbPbmUQ7Z1yxFM82fqa2mtHc/JWXfJVB TNbud5H4EAYB6HQsWuXLS+r5exvQogHDd+L8Z0Poq/q85O8YP87mG1CLjl4mV0a/6XNi jgO+M1k+pCyUYChxfZetTNbZpVvLBFavcztEUu+KRFJA/pSFMk2ek+Dl1CNbTgp7soaT Nx7BuNqnNjg7liCt5f/aMXoKpf7y+tp3Zc1v2LxSAtCXs0XPKHI9yn0dctaqZOq0Sc4H 6zYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fyfKeWBR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1-v6si4187113pll.57.2018.03.15.07.10.08; Thu, 15 Mar 2018 07:10:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fyfKeWBR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752172AbeCOOI1 (ORCPT + 99 others); Thu, 15 Mar 2018 10:08:27 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:41570 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751781AbeCOOIZ (ORCPT ); Thu, 15 Mar 2018 10:08:25 -0400 Received: by mail-pf0-f194.google.com with SMTP id f80so2848726pfa.8; Thu, 15 Mar 2018 07:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=jPPoUOCZHkGZ2ofFqZZzXJjYdJPCD9SyCuH/Rybxvyw=; b=fyfKeWBRBIusGDvQDmkVQnX59f3rr4xEj5PGBY7ikcm0Isa3B3jKFiHcaxTs4BFQsI UoU8ajKVczXjGNShhcbtqfbKgllv6YiGwVzTBzcKrW7VQwqThL/WujaSzZ7jM8vbeeW4 Nr4jBiVlVu1u6bt8zkcugBwoCJsAmdY6x8eu3ZrSuGt9T1RdP6BIbaaCIefDpCnf3++I uJbaO+akjYTJ9JbywVGGpBscD/0r/ZAoGTZMltkPL1aOZ0x2X7m1Ar3RDBXzUjfRmIu4 QUFJ9Ih2QjiuXJpL9cCkReh46HgrdO82L49Tjja5sTtqs1UB5hobHrXzZE9mm0AmKd0N r26g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=jPPoUOCZHkGZ2ofFqZZzXJjYdJPCD9SyCuH/Rybxvyw=; b=J8mpc11MoYw7ZhCozSAYE1No/Iyq/dD4qzkGQ3Axbx7mQUzrGqTsnP98gj0UMtlqLM YBCbfm2CxoppbiuiZtX+XxiWC+Mtis35maxHXW3ZMFHxUX7DliuHDxBIf2u0CuoF+81M mvDnOmAMFAnzSxuQNBZaRSZfufmpdox+s0gWTYuNzcvX95/CfOWmmYFu+tEODql3bAB1 ZJaVwUQp7yh85Xn1ktng0wSQlie5GUfHbT+cNHNEKUK/5Bji2e4jJa5rTq63L/7RkBym 8rbB06oBXthQ9bsnkgMjiA5HffeJ1POdsnrDMf5HGHmSjPUwjs42P5Uh/6wqJsO2IAEY Lnbw== X-Gm-Message-State: AElRT7ESMhLxDolb4qjQhiZcEY77ogGeEYXxSGzKlwjX73OnDWVWICZ+ bAWJeLU0Y3Gx2W4VYJUPKl8= X-Received: by 10.98.129.67 with SMTP id t64mr5329108pfd.137.1521122905039; Thu, 15 Mar 2018 07:08:25 -0700 (PDT) Received: from [0.0.0.0] (67.216.217.169.16clouds.com. [67.216.217.169]) by smtp.gmail.com with ESMTPSA id s67sm10371910pfg.104.2018.03.15.07.08.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 07:08:24 -0700 (PDT) Subject: Re: [PATCH] mm/page_alloc: fix boot hang in memmap_init_zone To: Daniel Vacek , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Sudeep Holla , Naresh Kamboju , Andrew Morton , Mel Gorman , Michal Hocko , Paul Burton , Pavel Tatashin , Vlastimil Babka , stable@vger.kernel.org, ard.biesheuvel@linaro.org References: <20180313224240.25295-1-neelx@redhat.com> From: Jia He Message-ID: <049a38e2-c446-85f4-656c-91d4e5bb1c0d@gmail.com> Date: Thu, 15 Mar 2018 22:08:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180313224240.25295-1-neelx@redhat.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel On 3/14/2018 6:42 AM, Daniel Vacek Wrote: > On some architectures (reported on arm64) commit 864b75f9d6b01 ("mm/page_alloc: fix memmap_init_zone pageblock alignment") > causes a boot hang. This patch fixes the hang making sure the alignment > never steps back. > > Link: http://lkml.kernel.org/r/0485727b2e82da7efbce5f6ba42524b429d0391a.1520011945.git.neelx@redhat.com > Fixes: 864b75f9d6b01 ("mm/page_alloc: fix memmap_init_zone pageblock alignment") > Signed-off-by: Daniel Vacek > Tested-by: Sudeep Holla > Tested-by: Naresh Kamboju > Cc: Andrew Morton > Cc: Mel Gorman > Cc: Michal Hocko > Cc: Paul Burton > Cc: Pavel Tatashin > Cc: Vlastimil Babka > Cc: > --- > mm/page_alloc.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 3d974cb2a1a1..e033a6895c6f 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -5364,9 +5364,14 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, > * is not. move_freepages_block() can shift ahead of > * the valid region but still depends on correct page > * metadata. > + * Also make sure we never step back. > */ > - pfn = (memblock_next_valid_pfn(pfn, end_pfn) & > + unsigned long next_pfn; > + > + next_pfn = (memblock_next_valid_pfn(pfn, end_pfn) & > ~(pageblock_nr_pages-1)) - 1; > + if (next_pfn > pfn) > + pfn = next_pfn; It didn't resolve the booting hang issue in my arm64 server. what if memblock_next_valid_pfn(pfn, end_pfn) is 32 and pageblock_nr_pages is 8196? Thus, next_pfn will be (unsigned long)-1 and be larger than pfn. So still there is an infinite loop here. Cheers, Jia He > #endif > continue; > } -- Cheers, Jia