Received: by 10.213.65.68 with SMTP id h4csp631588imn; Tue, 13 Mar 2018 15:45:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELsGwIB6T73V/yuKaS1jgRRZMrZPqHLxMyQA63fq+wwKUE+a1TGKXUHGWpJ69iH2M8mJV1QJ X-Received: by 10.101.80.197 with SMTP id s5mr1817986pgp.332.1520981130633; Tue, 13 Mar 2018 15:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520981130; cv=none; d=google.com; s=arc-20160816; b=0Y2B/VTZrxkN9IV6fSFqyqLH5ssWQwYZplZIOaafaL4oAO0LUYd5+dyLc8l6vYmFN1 rSTekKJT+FRhfPPv9UCJX5Yup6Xg60iEmaibx8Bcg5lYenU7jiS+SEaV9IXXNI64pmgG vYLZwODTtU79gnPRAOqOgbXMqkk31iWeRIHW+bn9h6ollEP4Nu6HLueddbhFX/O7t5NC XlTx7S903BWFYIxvxO9x77FBKqdsyE+c59rq+PvgzL+RoHo6Ojax5xLWD2ioML9aO63Z BYX99clJwzGUMPrAqvUMchZ3RW7S9JTyxTYMtVvR66jMGOYCN0vaxZ9OLcG/yoaP6yZN UCnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Xl0TsfsQIO/pxgcFVZpmVxmSv8OqjFE1VjyUVlRjdhE=; b=SlYYXFeNTCxQW8hVjHiv9D7Z9zq3DpdxMkhnKSw8rvhqWGdbdgfW17J8tAd3RGOJWz C8IdH+72S+6cunmYcTsYtnHus6+xyfzsHwHQsQwGDjN2eJ4xAbqutHlK1dXXQQJRd7nB 71n5uUUhnWfVebi7YV5wjHtmt3TzvwDJi/3RccJjqe/QJF8z7SMj23IUvGxiuRBpeqrH Df2AHv02CGXkuEL53rzcddjpvyjvjLDIzHboTLtlU19YSj8o+1dn4VzmNkm+IVMQiciD o9Xb7sPivq71tns3W1UR6PL1MxCJStGTZp4mU7kcqTMkRpi1WtMJRDixhw3ZIy1ACEFG KFrQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si830948pgz.96.2018.03.13.15.45.16; Tue, 13 Mar 2018 15:45:30 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932646AbeCMWnL (ORCPT + 99 others); Tue, 13 Mar 2018 18:43:11 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51236 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932205AbeCMWnK (ORCPT ); Tue, 13 Mar 2018 18:43:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA904BD9E; Tue, 13 Mar 2018 22:43:09 +0000 (UTC) Received: from metal.redhat.com (ovpn-204-24.brq.redhat.com [10.40.204.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDB501007278; Tue, 13 Mar 2018 22:43:03 +0000 (UTC) From: Daniel Vacek To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Sudeep Holla , Naresh Kamboju , Daniel Vacek , Andrew Morton , Mel Gorman , Michal Hocko , Paul Burton , Pavel Tatashin , Vlastimil Babka , stable@vger.kernel.org Subject: [PATCH] mm/page_alloc: fix boot hang in memmap_init_zone Date: Tue, 13 Mar 2018 23:42:40 +0100 Message-Id: <20180313224240.25295-1-neelx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 13 Mar 2018 22:43:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 13 Mar 2018 22:43:09 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'neelx@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; #endif continue; } -- 2.16.2