linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Mel Gorman <mgorman@techsingularity.net>
Subject: [PATCH 3/3] mm, meminit: Ensure node is online before checking whether pages are uninitialised
Date: Fri,  8 Jul 2016 21:00:31 +0100	[thread overview]
Message-ID: <1468008031-3848-4-git-send-email-mgorman@techsingularity.net> (raw)
In-Reply-To: <1468008031-3848-1-git-send-email-mgorman@techsingularity.net>

early_page_uninitialised looks up an arbitrary PFN. While a machine without
node 0 will boot with "mm, page_alloc: Always return a valid node from
early_pfn_to_nid", it works because it assumes that nodes are always in
PFN order. This is not guaranteed so this patch adds robustness by always
checking if the node being checked is online.

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Cc: <stable@vger.kernel.org> # 4.2+
---
 mm/page_alloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5a616de1adca..03c9322da942 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -286,7 +286,9 @@ static inline void reset_deferred_meminit(pg_data_t *pgdat)
 /* Returns true if the struct page for the pfn is uninitialised */
 static inline bool __meminit early_page_uninitialised(unsigned long pfn)
 {
-	if (pfn >= NODE_DATA(early_pfn_to_nid(pfn))->first_deferred_pfn)
+	int nid = early_pfn_to_nid(pfn);
+
+	if (node_online(nid) && pfn >= NODE_DATA(nid)->first_deferred_pfn)
 		return true;
 
 	return false;
-- 
2.6.4

  parent reply	other threads:[~2016-07-08 20:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08 20:00 [PATCH 0/3] Fix boot problem with deferred meminit on machine with no node 0 Mel Gorman
2016-07-08 20:00 ` [PATCH 1/3] mm, meminit: Remove early_page_nid_uninitialised Mel Gorman
2016-07-08 20:00 ` [PATCH 2/3] mm, meminit: Always return a valid node from early_pfn_to_nid Mel Gorman
2016-07-12 23:26   ` David Rientjes
2016-07-13 10:34     ` Mel Gorman
2016-07-08 20:00 ` Mel Gorman [this message]
2016-07-12 23:28   ` [PATCH 3/3] mm, meminit: Ensure node is online before checking whether pages are uninitialised David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468008031-3848-4-git-send-email-mgorman@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).