All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Yang Shi <yang.shi@linaro.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: "mm: use early_pfn_to_nid in page_ext_init" broken on some configurations?
Date: Fri, 30 Jun 2017 17:42:24 +0200	[thread overview]
Message-ID: <20170630154224.GA9714@dhcp22.suse.cz> (raw)
In-Reply-To: <20170630141847.GN22917@dhcp22.suse.cz>

On Fri 30-06-17 16:18:47, Michal Hocko wrote:
> fe53ca54270a ("mm: use early_pfn_to_nid in page_ext_init") seem
> to silently depend on CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID resp.
> CONFIG_HAVE_MEMBLOCK_NODE_MAP. early_pfn_to_nid is returning zero with
> !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
> I am not sure how widely is this used but such a code is tricky. I see
> how catching early allocations during defered initialization might be
> useful but a subtly broken code sounds like a problem to me.  So is
> fe53ca54270a worth this or we should revert it?

I've dug little bit further. It seems that only s390 and ia64 select
HAVE_ARCH_EARLY_PFN_TO_NID. Much more architectures enabled
HAVE_MEMBLOCK_NODE_MAP though but still
alpha, arc, arm, avr32, blackfin, c6x, cris, frv, h8300, hexagon,
Kconfig, m32r, m68k, mn10300, nios2, openrisc, parisc, tile, um,
unicore32, xtensa do not. I can only see alpha having NUMA and even that
is marked BROKEN. So it seems that this is not a real problem after all.

Still subtle, so I guess we want to have the following. What do you
think?

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 16532fa0bb64..894697c1e6f5 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1055,6 +1055,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
 	!defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
 static inline unsigned long early_pfn_to_nid(unsigned long pfn)
 {
+	BUILD_BUG_ON(!IS_ENABLED(CONFIG_NUMA));
 	return 0;
 }
 #endif
-- 
Michal Hocko
SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Yang Shi <yang.shi@linaro.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: "mm: use early_pfn_to_nid in page_ext_init" broken on some configurations?
Date: Fri, 30 Jun 2017 17:42:24 +0200	[thread overview]
Message-ID: <20170630154224.GA9714@dhcp22.suse.cz> (raw)
In-Reply-To: <20170630141847.GN22917@dhcp22.suse.cz>

On Fri 30-06-17 16:18:47, Michal Hocko wrote:
> fe53ca54270a ("mm: use early_pfn_to_nid in page_ext_init") seem
> to silently depend on CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID resp.
> CONFIG_HAVE_MEMBLOCK_NODE_MAP. early_pfn_to_nid is returning zero with
> !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
> I am not sure how widely is this used but such a code is tricky. I see
> how catching early allocations during defered initialization might be
> useful but a subtly broken code sounds like a problem to me.  So is
> fe53ca54270a worth this or we should revert it?

I've dug little bit further. It seems that only s390 and ia64 select
HAVE_ARCH_EARLY_PFN_TO_NID. Much more architectures enabled
HAVE_MEMBLOCK_NODE_MAP though but still
alpha, arc, arm, avr32, blackfin, c6x, cris, frv, h8300, hexagon,
Kconfig, m32r, m68k, mn10300, nios2, openrisc, parisc, tile, um,
unicore32, xtensa do not. I can only see alpha having NUMA and even that
is marked BROKEN. So it seems that this is not a real problem after all.

Still subtle, so I guess we want to have the following. What do you
think?

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 16532fa0bb64..894697c1e6f5 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1055,6 +1055,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
 	!defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
 static inline unsigned long early_pfn_to_nid(unsigned long pfn)
 {
+	BUILD_BUG_ON(!IS_ENABLED(CONFIG_NUMA));
 	return 0;
 }
 #endif
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-06-30 15:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 14:18 "mm: use early_pfn_to_nid in page_ext_init" broken on some configurations? Michal Hocko
2017-06-30 14:18 ` Michal Hocko
2017-06-30 15:42 ` Michal Hocko [this message]
2017-06-30 15:42   ` Michal Hocko
2017-06-30 15:44   ` Michal Hocko
2017-06-30 15:44     ` Michal Hocko
2017-07-04  5:11     ` Joonsoo Kim
2017-07-04  5:11       ` Joonsoo Kim
2017-07-04  6:51       ` Michal Hocko
2017-07-04  6:51         ` Michal Hocko
2017-07-03 11:48 ` Vlastimil Babka
2017-07-03 11:48   ` Vlastimil Babka
2017-07-03 14:18   ` Vlastimil Babka
2017-07-03 14:18     ` Vlastimil Babka
2017-07-04  5:23     ` Joonsoo Kim
2017-07-04  5:23       ` Joonsoo Kim
2017-07-04  9:39       ` Vlastimil Babka
2017-07-04  9:39         ` Vlastimil Babka
2017-07-04 10:53         ` Michal Hocko
2017-07-04 10:53           ` Michal Hocko
2017-07-04  5:17   ` Joonsoo Kim
2017-07-04  5:17     ` Joonsoo Kim
2017-07-07 12:00     ` Vlastimil Babka
2017-07-07 12:00       ` Vlastimil Babka
2017-07-14  9:13       ` Michal Hocko
2017-07-14  9:13         ` Michal Hocko
2017-07-14  9:34         ` Vlastimil Babka
2017-07-14  9:34           ` Vlastimil Babka
2017-07-14 11:35           ` Michal Hocko
2017-07-14 11:35             ` Michal Hocko

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=20170630154224.GA9714@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=vbabka@suse.cz \
    --cc=yang.shi@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.