All of
 help / color / mirror / Atom feed
From: David Hildenbrand <>
Cc:,,, David Hildenbrand <>,
	Pankaj Gupta <>,
	Muchun Song <>,
	Oscar Salvador <>
Subject: [PATCH 4.14 STABLE] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
Date: Mon, 20 Sep 2021 13:22:46 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

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

      parent reply	other threads:[~2021-09-20 11:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2021-09-17 12:06 ` FAILED: patch "[PATCH] mm/memory_hotplug: use "unsigned long" for PFN in" failed to apply to 4.14-stable tree David Hildenbrand
2021-09-17 12:17   ` Greg KH
2021-09-20 11:22 ` David Hildenbrand [this message]

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \

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