LKML Archive on
help / color / mirror / Atom feed
* [PATCH 4.14 STABLE] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
       [not found] <>
@ 2021-09-20 11:22 ` David Hildenbrand
  0 siblings, 0 replies; only message in thread
From: David Hildenbrand @ 2021-09-20 11:22 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, linux-mm, gregkh, David Hildenbrand, Pankaj Gupta,
	Muchun Song, Oscar Salvador

commit 7cf209ba8a86410939a24cb1aeb279479a7e0ca6 upstream.

Patch series "mm/memory_hotplug: preparatory patches for new online policy and memory"

These are all cleanups and one fix previously sent as part of [1]:
[PATCH v1 00/12] mm/memory_hotplug: "auto-movable" online policy and memory

These patches make sense even without the other series, therefore I pulled
them out to make the other series easier to digest.


This patch (of 4):

Checkpatch complained on a follow-up patch that we are using "unsigned"
here, which defaults to "unsigned int" and checkpatch is correct.

As we will search for a fitting zone using the wrong pfn, we might end
up onlining memory to one of the special kernel zones, such as ZONE_DMA,
which can end badly as the onlined memory does not satisfy properties of
these zones.

Use "unsigned long" instead, just as we do in other places when handling
PFNs.  This can bite us once we have physical addresses in the range of
multiple TB.

Fixes: e5e689302633 ("mm, memory_hotplug: display allowed zones in the preferred ordering")
Signed-off-by: David Hildenbrand <>
Reviewed-by: Pankaj Gupta <>
Reviewed-by: Muchun Song <>
Reviewed-by: Oscar Salvador <>
Cc: David Hildenbrand <>
Cc: Vitaly Kuznetsov <>
Cc: "Michael S. Tsirkin" <>
Cc: Jason Wang <>
Cc: Pankaj Gupta <>
Cc: Wei Yang <>
Cc: Michal Hocko <>
Cc: Dan Williams <>
Cc: Anshuman Khandual <>
Cc: Dave Hansen <>
Cc: Vlastimil Babka <>
Cc: Mike Rapoport <>
Cc: "Rafael J. Wysocki" <>
Cc: Len Brown <>
Cc: Pavel Tatashin <>
Cc: Heiko Carstens <>
Cc: Michael Ellerman <>
Cc: Catalin Marinas <>
Cc: Andy Lutomirski <>
Cc: "Aneesh Kumar K.V" <>
Cc: Anton Blanchard <>
Cc: Ard Biesheuvel <>
Cc: Baoquan He <>
Cc: Benjamin Herrenschmidt <>
Cc: Borislav Petkov <>
Cc: Christian Borntraeger <>
Cc: Christophe Leroy <>
Cc: Dave Jiang <>
Cc: "H. Peter Anvin" <>
Cc: Ingo Molnar <>
Cc: Jia He <>
Cc: Joe Perches <>
Cc: Kefeng Wang <>
Cc: Laurent Dufour <>
Cc: Michel Lespinasse <>
Cc: Nathan Lynch <>
Cc: Nicholas Piggin <>
Cc: Paul Mackerras <>
Cc: Peter Zijlstra <>
Cc: Pierre Morel <>
Cc: "Rafael J. Wysocki" <>
Cc: Rich Felker <>
Cc: Scott Cheloha <>
Cc: Sergei Trofimovich <>
Cc: Thiago Jung Bauermann <>
Cc: Thomas Gleixner <>
Cc: Vasily Gorbik <>
Cc: Vishal Verma <>
Cc: Will Deacon <>
Cc: Yoshinori Sato <>
Cc: <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: David Hildenbrand <>
 include/linux/memory_hotplug.h | 4 ++--
 mm/memory_hotplug.c            | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index d36a02935391..8c48d9e0ca22 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -332,6 +332,6 @@ extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
 					  unsigned long pnum);
 extern bool allow_online_pfn_range(int nid, unsigned long pfn, unsigned long nr_pages,
 		int online_type);
-extern struct zone *zone_for_pfn_range(int online_type, int nid, unsigned start_pfn,
-		unsigned long nr_pages);
+extern struct zone *zone_for_pfn_range(int online_type, int nid,
+		unsigned long start_pfn, unsigned long nr_pages);
 #endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 2d6626ab29d1..c2878d48b8b1 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -842,8 +842,8 @@ static inline struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn
 	return movable_node_enabled ? movable_zone : kernel_zone;
-struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn,
-		unsigned long nr_pages)
+struct zone *zone_for_pfn_range(int online_type, int nid,
+		unsigned long start_pfn, unsigned long nr_pages)
 	if (online_type == MMOP_ONLINE_KERNEL)
 		return default_kernel_zone_for_pfn(nid, start_pfn, nr_pages);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-20 11:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
2021-09-20 11:22 ` [PATCH 4.14 STABLE] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand

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).