[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210920122728.8241-1-david@redhat.com>
Date: Mon, 20 Sep 2021 14:27:28 +0200
From: David Hildenbrand <david@...hat.com>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
gregkh@...uxfoundation.org, David Hildenbrand <david@...hat.com>,
Pankaj Gupta <pankaj.gupta@...os.com>,
Muchun Song <songmuchun@...edance.com>,
Oscar Salvador <osalvador@...e.de>
Subject: [PATCH 5.10 STABLE] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
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
groups.
These patches make sense even without the other series, therefore I pulled
them out to make the other series easier to digest.
[1] https://lkml.kernel.org/r/20210607195430.48228-1-david@redhat.com
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.
Link: https://lkml.kernel.org/r/20210712124052.26491-2-david@redhat.com
Fixes: e5e689302633 ("mm, memory_hotplug: display allowed zones in the preferred ordering")
Signed-off-by: David Hildenbrand <david@...hat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@...os.com>
Reviewed-by: Muchun Song <songmuchun@...edance.com>
Reviewed-by: Oscar Salvador <osalvador@...e.de>
Cc: David Hildenbrand <david@...hat.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Jason Wang <jasowang@...hat.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@...il.com>
Cc: Wei Yang <richard.weiyang@...ux.alibaba.com>
Cc: Michal Hocko <mhocko@...nel.org>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Anshuman Khandual <anshuman.khandual@....com>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Vlastimil Babka <vbabka@...e.cz>
Cc: Mike Rapoport <rppt@...nel.org>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Len Brown <lenb@...nel.org>
Cc: Pavel Tatashin <pasha.tatashin@...een.com>
Cc: Heiko Carstens <hca@...ux.ibm.com>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: virtualization@...ts.linux-foundation.org
Cc: Andy Lutomirski <luto@...nel.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>
Cc: Anton Blanchard <anton@...abs.org>
Cc: Ard Biesheuvel <ardb@...nel.org>
Cc: Baoquan He <bhe@...hat.com>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Christian Borntraeger <borntraeger@...ibm.com>
Cc: Christophe Leroy <christophe.leroy@....fr>
Cc: Dave Jiang <dave.jiang@...el.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Jia He <justin.he@....com>
Cc: Joe Perches <joe@...ches.com>
Cc: Kefeng Wang <wangkefeng.wang@...wei.com>
Cc: Laurent Dufour <ldufour@...ux.ibm.com>
Cc: Michel Lespinasse <michel@...pinasse.org>
Cc: Nathan Lynch <nathanl@...ux.ibm.com>
Cc: Nicholas Piggin <npiggin@...il.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Pierre Morel <pmorel@...ux.ibm.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Cc: Rich Felker <dalias@...c.org>
Cc: Scott Cheloha <cheloha@...ux.ibm.com>
Cc: Sergei Trofimovich <slyfox@...too.org>
Cc: Thiago Jung Bauermann <bauerman@...ux.ibm.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Vasily Gorbik <gor@...ux.ibm.com>
Cc: Vishal Verma <vishal.l.verma@...el.com>
Cc: Will Deacon <will@...nel.org>
Cc: Yoshinori Sato <ysato@...rs.sourceforge.jp>
Cc: <stable@...r.kernel.org>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: David Hildenbrand <david@...hat.com>
---
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 551093b74596..1dafc7c7f5cf 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -359,8 +359,8 @@ extern void sparse_remove_section(struct mem_section *ms,
unsigned long map_offset, struct vmem_altmap *altmap);
extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
unsigned long pnum);
-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 /* CONFIG_MEMORY_HOTPLUG */
#endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b9de2df5b835..6275b1c05f11 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -765,8 +765,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);
--
2.31.1
Powered by blists - more mailing lists