linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mm/memory_hotplug: preparatory patches for new online policy and memory
@ 2021-07-12 12:40 David Hildenbrand
  2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: David Hildenbrand @ 2021-07-12 12:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, David Hildenbrand, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Pankaj Gupta, Wei Yang,
	Oscar Salvador, Michal Hocko, Dan Williams, Anshuman Khandual,
	Dave Hansen, Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki,
	Len Brown, Pavel Tatashin, Heiko Carstens, Michael Ellerman,
	Catalin Marinas, virtualization, linux-acpi, Andy Lutomirski,
	Aneesh Kumar K.V, Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato

Hi,

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

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: virtualization@lists.linux-foundation.org
Cc: linux-mm@kvack.org
Cc: linux-acpi@vger.kernel.org

David Hildenbrand (4):
  mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
  mm/memory_hotplug: remove nid parameter from arch_remove_memory()
  mm/memory_hotplug: remove nid parameter from remove_memory() and
    friends
  ACPI: memhotplug: memory resources cannot be enabled yet

 arch/arm64/mm/mmu.c                           |  3 +-
 arch/ia64/mm/init.c                           |  3 +-
 arch/powerpc/mm/mem.c                         |  3 +-
 .../platforms/pseries/hotplug-memory.c        |  9 +++--
 arch/s390/mm/init.c                           |  3 +-
 arch/sh/mm/init.c                             |  3 +-
 arch/x86/mm/init_32.c                         |  3 +-
 arch/x86/mm/init_64.c                         |  3 +-
 drivers/acpi/acpi_memhotplug.c                | 11 +-----
 drivers/dax/kmem.c                            |  3 +-
 drivers/virtio/virtio_mem.c                   |  4 +--
 include/linux/memory_hotplug.h                | 17 +++++----
 mm/memory_hotplug.c                           | 36 +++++++++++--------
 mm/memremap.c                                 |  5 +--
 14 files changed, 45 insertions(+), 61 deletions(-)


base-commit: e73f0f0ee7541171d89f2e2491130c7771ba58d3
-- 
2.31.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
  2021-07-12 12:40 mm/memory_hotplug: preparatory patches for new online policy and memory David Hildenbrand
@ 2021-07-12 12:40 ` David Hildenbrand
  2021-07-14 20:13   ` Heiko Carstens
                     ` (3 more replies)
  2021-07-12 12:40 ` [PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory() David Hildenbrand
                   ` (2 subsequent siblings)
  3 siblings, 4 replies; 12+ messages in thread
From: David Hildenbrand @ 2021-07-12 12:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, David Hildenbrand, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Pankaj Gupta, Wei Yang,
	Oscar Salvador, Michal Hocko, Dan Williams, Anshuman Khandual,
	Dave Hansen, Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki,
	Len Brown, Pavel Tatashin, Heiko Carstens, Michael Ellerman,
	Catalin Marinas, virtualization, linux-acpi, Andy Lutomirski,
	Aneesh Kumar K.V, Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato

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

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 <david@redhat.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 a7fd2c3ccb77..d01b504ce06f 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -339,8 +339,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);
 extern int arch_create_linear_mapping(int nid, u64 start, u64 size,
 				      struct mhp_params *params);
 void arch_remove_linear_mapping(u64 start, u64 size);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 8cb75b26ea4f..93b3abaf9828 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -708,8 +708,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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory()
  2021-07-12 12:40 mm/memory_hotplug: preparatory patches for new online policy and memory David Hildenbrand
  2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
@ 2021-07-12 12:40 ` David Hildenbrand
  2021-07-14 20:47   ` Pankaj Gupta
  2021-07-12 12:40 ` [PATCH v1 3/4] mm/memory_hotplug: remove nid parameter from remove_memory() and friends David Hildenbrand
  2021-07-12 12:40 ` [PATCH v1 4/4] ACPI: memhotplug: memory resources cannot be enabled yet David Hildenbrand
  3 siblings, 1 reply; 12+ messages in thread
From: David Hildenbrand @ 2021-07-12 12:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, David Hildenbrand, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Pankaj Gupta, Wei Yang,
	Oscar Salvador, Michal Hocko, Dan Williams, Anshuman Khandual,
	Dave Hansen, Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki,
	Len Brown, Pavel Tatashin, Heiko Carstens, Michael Ellerman,
	Catalin Marinas, virtualization, linux-acpi, Andy Lutomirski,
	Aneesh Kumar K.V, Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato, x86, linux-arm-kernel, linux-ia64, linuxppc-dev,
	linux-s390, linux-sh

The parameter is unused, let's remove it.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Acked-by: Heiko Carstens <hca@linux.ibm.com> (s390)
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Laurent Dufour <ldufour@linux.ibm.com>
Cc: Sergei Trofimovich <slyfox@gentoo.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Michel Lespinasse <michel@lespinasse.org>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Cc: Joe Perches <joe@perches.com>
Cc: Pierre Morel <pmorel@linux.ibm.com>
Cc: Jia He <justin.he@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-ia64@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 arch/arm64/mm/mmu.c            | 3 +--
 arch/ia64/mm/init.c            | 3 +--
 arch/powerpc/mm/mem.c          | 3 +--
 arch/s390/mm/init.c            | 3 +--
 arch/sh/mm/init.c              | 3 +--
 arch/x86/mm/init_32.c          | 3 +--
 arch/x86/mm/init_64.c          | 3 +--
 include/linux/memory_hotplug.h | 3 +--
 mm/memory_hotplug.c            | 4 ++--
 mm/memremap.c                  | 5 +----
 10 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index d74586508448..af8ab553a268 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -1506,8 +1506,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
 	return ret;
 }
 
-void arch_remove_memory(int nid, u64 start, u64 size,
-			struct vmem_altmap *altmap)
+void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
 {
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 064a967a7b6e..5c6da8d83c1a 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -484,8 +484,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
 	return ret;
 }
 
-void arch_remove_memory(int nid, u64 start, u64 size,
-			struct vmem_altmap *altmap)
+void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
 {
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index ad198b439222..c3c4e31462ec 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -119,8 +119,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
 	return rc;
 }
 
-void __ref arch_remove_memory(int nid, u64 start, u64 size,
-			      struct vmem_altmap *altmap)
+void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
 {
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 8ac710de1ab1..d85bd7f5d8dc 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -306,8 +306,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
 	return rc;
 }
 
-void arch_remove_memory(int nid, u64 start, u64 size,
-			struct vmem_altmap *altmap)
+void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
 {
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce26c7f8950a..506784702430 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -414,8 +414,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
 	return ret;
 }
 
-void arch_remove_memory(int nid, u64 start, u64 size,
-			struct vmem_altmap *altmap)
+void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
 {
 	unsigned long start_pfn = PFN_DOWN(start);
 	unsigned long nr_pages = size >> PAGE_SHIFT;
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 74b78840182d..bd90b8fe81e4 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -801,8 +801,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
 	return __add_pages(nid, start_pfn, nr_pages, params);
 }
 
-void arch_remove_memory(int nid, u64 start, u64 size,
-			struct vmem_altmap *altmap)
+void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
 {
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ddeaba947eb3..a6e11763763f 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1255,8 +1255,7 @@ kernel_physical_mapping_remove(unsigned long start, unsigned long end)
 	remove_pagetable(start, end, true, NULL);
 }
 
-void __ref arch_remove_memory(int nid, u64 start, u64 size,
-			      struct vmem_altmap *altmap)
+void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
 {
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index d01b504ce06f..010a192298b5 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -130,8 +130,7 @@ static inline bool movable_node_is_enabled(void)
 	return movable_node_enabled;
 }
 
-extern void arch_remove_memory(int nid, u64 start, u64 size,
-			       struct vmem_altmap *altmap);
+extern void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap);
 extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages,
 			   struct vmem_altmap *altmap);
 
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 93b3abaf9828..f2a9af3af184 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1106,7 +1106,7 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
 	/* create memory block devices after memory was added */
 	ret = create_memory_block_devices(start, size, mhp_altmap.alloc);
 	if (ret) {
-		arch_remove_memory(nid, start, size, NULL);
+		arch_remove_memory(start, size, NULL);
 		goto error;
 	}
 
@@ -1892,7 +1892,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
 
 	mem_hotplug_begin();
 
-	arch_remove_memory(nid, start, size, altmap);
+	arch_remove_memory(start, size, altmap);
 
 	if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) {
 		memblock_free(start, size);
diff --git a/mm/memremap.c b/mm/memremap.c
index 15a074ffb8d7..ed593bf87109 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -140,14 +140,11 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id)
 {
 	struct range *range = &pgmap->ranges[range_id];
 	struct page *first_page;
-	int nid;
 
 	/* make sure to access a memmap that was actually initialized */
 	first_page = pfn_to_page(pfn_first(pgmap, range_id));
 
 	/* pages are dead and unused, undo the arch mapping */
-	nid = page_to_nid(first_page);
-
 	mem_hotplug_begin();
 	remove_pfn_range_from_zone(page_zone(first_page), PHYS_PFN(range->start),
 				   PHYS_PFN(range_len(range)));
@@ -155,7 +152,7 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id)
 		__remove_pages(PHYS_PFN(range->start),
 			       PHYS_PFN(range_len(range)), NULL);
 	} else {
-		arch_remove_memory(nid, range->start, range_len(range),
+		arch_remove_memory(range->start, range_len(range),
 				pgmap_altmap(pgmap));
 		kasan_remove_zero_shadow(__va(range->start), range_len(range));
 	}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 3/4] mm/memory_hotplug: remove nid parameter from remove_memory() and friends
  2021-07-12 12:40 mm/memory_hotplug: preparatory patches for new online policy and memory David Hildenbrand
  2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
  2021-07-12 12:40 ` [PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory() David Hildenbrand
@ 2021-07-12 12:40 ` David Hildenbrand
  2021-07-12 12:40 ` [PATCH v1 4/4] ACPI: memhotplug: memory resources cannot be enabled yet David Hildenbrand
  3 siblings, 0 replies; 12+ messages in thread
From: David Hildenbrand @ 2021-07-12 12:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, David Hildenbrand, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Pankaj Gupta, Wei Yang,
	Oscar Salvador, Michal Hocko, Dan Williams, Anshuman Khandual,
	Dave Hansen, Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki,
	Len Brown, Pavel Tatashin, Heiko Carstens, Michael Ellerman,
	Catalin Marinas, virtualization, linux-acpi, Andy Lutomirski,
	Aneesh Kumar K.V, Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato, linuxppc-dev, nvdimm

There is only a single user remaining. We can simply lookup the nid only
used for node offlining purposes when walking our memory blocks. We
don't expect to remove multi-nid ranges; and if we'd ever do, we most
probably don't care about removing multi-nid ranges that actually result
in empty nodes.

If ever required, we can detect the "multi-nid" scenario and simply try
offlining all online nodes.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Nathan Lynch <nathanl@linux.ibm.com>
Cc: Laurent Dufour <ldufour@linux.ibm.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Scott Cheloha <cheloha@linux.ibm.com>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-acpi@vger.kernel.org
Cc: nvdimm@lists.linux.dev
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 .../platforms/pseries/hotplug-memory.c        |  9 +++---
 drivers/acpi/acpi_memhotplug.c                |  7 +----
 drivers/dax/kmem.c                            |  3 +-
 drivers/virtio/virtio_mem.c                   |  4 +--
 include/linux/memory_hotplug.h                | 10 +++----
 mm/memory_hotplug.c                           | 28 +++++++++++--------
 6 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 377d852f5a9a..ef5c24b42cf1 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -286,7 +286,7 @@ static int pseries_remove_memblock(unsigned long base, unsigned long memblock_si
 {
 	unsigned long block_sz, start_pfn;
 	int sections_per_block;
-	int i, nid;
+	int i;
 
 	start_pfn = base >> PAGE_SHIFT;
 
@@ -297,10 +297,9 @@ static int pseries_remove_memblock(unsigned long base, unsigned long memblock_si
 
 	block_sz = pseries_memory_block_size();
 	sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE;
-	nid = memory_add_physaddr_to_nid(base);
 
 	for (i = 0; i < sections_per_block; i++) {
-		__remove_memory(nid, base, MIN_MEMORY_BLOCK_SIZE);
+		__remove_memory(base, MIN_MEMORY_BLOCK_SIZE);
 		base += MIN_MEMORY_BLOCK_SIZE;
 	}
 
@@ -387,7 +386,7 @@ static int dlpar_remove_lmb(struct drmem_lmb *lmb)
 
 	block_sz = pseries_memory_block_size();
 
-	__remove_memory(mem_block->nid, lmb->base_addr, block_sz);
+	__remove_memory(lmb->base_addr, block_sz);
 	put_device(&mem_block->dev);
 
 	/* Update memory regions for memory remove */
@@ -660,7 +659,7 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
 
 	rc = dlpar_online_lmb(lmb);
 	if (rc) {
-		__remove_memory(nid, lmb->base_addr, block_sz);
+		__remove_memory(lmb->base_addr, block_sz);
 		invalidate_lmb_associativity_index(lmb);
 	} else {
 		lmb->flags |= DRCONF_MEM_ASSIGNED;
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 8cc195c4c861..1d01d9414c40 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -239,19 +239,14 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 
 static void acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
 {
-	acpi_handle handle = mem_device->device->handle;
 	struct acpi_memory_info *info, *n;
-	int nid = acpi_get_node(handle);
 
 	list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
 		if (!info->enabled)
 			continue;
 
-		if (nid == NUMA_NO_NODE)
-			nid = memory_add_physaddr_to_nid(info->start_addr);
-
 		acpi_unbind_memory_blocks(info);
-		__remove_memory(nid, info->start_addr, info->length);
+		__remove_memory(info->start_addr, info->length);
 		list_del(&info->list);
 		kfree(info);
 	}
diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
index ac231cc36359..99e0f60c4c26 100644
--- a/drivers/dax/kmem.c
+++ b/drivers/dax/kmem.c
@@ -156,8 +156,7 @@ static void dev_dax_kmem_remove(struct dev_dax *dev_dax)
 		if (rc)
 			continue;
 
-		rc = remove_memory(dev_dax->target_node, range.start,
-				range_len(&range));
+		rc = remove_memory(range.start, range_len(&range));
 		if (rc == 0) {
 			release_resource(data->res[i]);
 			kfree(data->res[i]);
diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
index 09ed55de07d7..774986695dc4 100644
--- a/drivers/virtio/virtio_mem.c
+++ b/drivers/virtio/virtio_mem.c
@@ -677,7 +677,7 @@ static int virtio_mem_remove_memory(struct virtio_mem *vm, uint64_t addr,
 
 	dev_dbg(&vm->vdev->dev, "removing memory: 0x%llx - 0x%llx\n", addr,
 		addr + size - 1);
-	rc = remove_memory(vm->nid, addr, size);
+	rc = remove_memory(addr, size);
 	if (!rc) {
 		atomic64_sub(size, &vm->offline_size);
 		/*
@@ -720,7 +720,7 @@ static int virtio_mem_offline_and_remove_memory(struct virtio_mem *vm,
 		"offlining and removing memory: 0x%llx - 0x%llx\n", addr,
 		addr + size - 1);
 
-	rc = offline_and_remove_memory(vm->nid, addr, size);
+	rc = offline_and_remove_memory(addr, size);
 	if (!rc) {
 		atomic64_sub(size, &vm->offline_size);
 		/*
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 010a192298b5..068e3dcf4690 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -292,9 +292,9 @@ static inline void pgdat_resize_init(struct pglist_data *pgdat) {}
 
 extern void try_offline_node(int nid);
 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
-extern int remove_memory(int nid, u64 start, u64 size);
-extern void __remove_memory(int nid, u64 start, u64 size);
-extern int offline_and_remove_memory(int nid, u64 start, u64 size);
+extern int remove_memory(u64 start, u64 size);
+extern void __remove_memory(u64 start, u64 size);
+extern int offline_and_remove_memory(u64 start, u64 size);
 
 #else
 static inline void try_offline_node(int nid) {}
@@ -304,12 +304,12 @@ static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
 	return -EINVAL;
 }
 
-static inline int remove_memory(int nid, u64 start, u64 size)
+static inline int remove_memory(u64 start, u64 size)
 {
 	return -EBUSY;
 }
 
-static inline void __remove_memory(int nid, u64 start, u64 size) {}
+static inline void __remove_memory(u64 start, u64 size) {}
 #endif /* CONFIG_MEMORY_HOTREMOVE */
 
 extern void set_zone_contiguous(struct zone *zone);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index f2a9af3af184..388c8627f17f 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1745,7 +1745,9 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages)
 static int check_memblock_offlined_cb(struct memory_block *mem, void *arg)
 {
 	int ret = !is_memblock_offlined(mem);
+	int *nid = arg;
 
+	*nid = mem->nid;
 	if (unlikely(ret)) {
 		phys_addr_t beginpa, endpa;
 
@@ -1838,12 +1840,12 @@ void try_offline_node(int nid)
 }
 EXPORT_SYMBOL(try_offline_node);
 
-static int __ref try_remove_memory(int nid, u64 start, u64 size)
+static int __ref try_remove_memory(u64 start, u64 size)
 {
-	int rc = 0;
 	struct vmem_altmap mhp_altmap = {};
 	struct vmem_altmap *altmap = NULL;
 	unsigned long nr_vmemmap_pages;
+	int rc = 0, nid = NUMA_NO_NODE;
 
 	BUG_ON(check_hotplug_memory_range(start, size));
 
@@ -1851,8 +1853,12 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
 	 * All memory blocks must be offlined before removing memory.  Check
 	 * whether all memory blocks in question are offline and return error
 	 * if this is not the case.
+	 *
+	 * While at it, determine the nid. Note that if we'd have mixed nodes,
+	 * we'd only try to offline the last determined one -- which is good
+	 * enough for the cases we care about.
 	 */
-	rc = walk_memory_blocks(start, size, NULL, check_memblock_offlined_cb);
+	rc = walk_memory_blocks(start, size, &nid, check_memblock_offlined_cb);
 	if (rc)
 		return rc;
 
@@ -1901,7 +1907,8 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
 
 	release_mem_region_adjustable(start, size);
 
-	try_offline_node(nid);
+	if (nid != NUMA_NO_NODE)
+		try_offline_node(nid);
 
 	mem_hotplug_done();
 	return 0;
@@ -1909,7 +1916,6 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
 
 /**
  * __remove_memory - Remove memory if every memory block is offline
- * @nid: the node ID
  * @start: physical address of the region to remove
  * @size: size of the region to remove
  *
@@ -1917,14 +1923,14 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
  * and online/offline operations before this call, as required by
  * try_offline_node().
  */
-void __remove_memory(int nid, u64 start, u64 size)
+void __remove_memory(u64 start, u64 size)
 {
 
 	/*
 	 * trigger BUG() if some memory is not offlined prior to calling this
 	 * function
 	 */
-	if (try_remove_memory(nid, start, size))
+	if (try_remove_memory(start, size))
 		BUG();
 }
 
@@ -1932,12 +1938,12 @@ void __remove_memory(int nid, u64 start, u64 size)
  * Remove memory if every memory block is offline, otherwise return -EBUSY is
  * some memory is not offline
  */
-int remove_memory(int nid, u64 start, u64 size)
+int remove_memory(u64 start, u64 size)
 {
 	int rc;
 
 	lock_device_hotplug();
-	rc  = try_remove_memory(nid, start, size);
+	rc = try_remove_memory(start, size);
 	unlock_device_hotplug();
 
 	return rc;
@@ -1997,7 +2003,7 @@ static int try_reonline_memory_block(struct memory_block *mem, void *arg)
  * unplugged all memory (so it's no longer in use) and want to offline + remove
  * that memory.
  */
-int offline_and_remove_memory(int nid, u64 start, u64 size)
+int offline_and_remove_memory(u64 start, u64 size)
 {
 	const unsigned long mb_count = size / memory_block_size_bytes();
 	uint8_t *online_types, *tmp;
@@ -2033,7 +2039,7 @@ int offline_and_remove_memory(int nid, u64 start, u64 size)
 	 * This cannot fail as it cannot get onlined in the meantime.
 	 */
 	if (!rc) {
-		rc = try_remove_memory(nid, start, size);
+		rc = try_remove_memory(start, size);
 		if (rc)
 			pr_err("%s: Failed to remove memory: %d", __func__, rc);
 	}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 4/4] ACPI: memhotplug: memory resources cannot be enabled yet
  2021-07-12 12:40 mm/memory_hotplug: preparatory patches for new online policy and memory David Hildenbrand
                   ` (2 preceding siblings ...)
  2021-07-12 12:40 ` [PATCH v1 3/4] mm/memory_hotplug: remove nid parameter from remove_memory() and friends David Hildenbrand
@ 2021-07-12 12:40 ` David Hildenbrand
  3 siblings, 0 replies; 12+ messages in thread
From: David Hildenbrand @ 2021-07-12 12:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, David Hildenbrand, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Pankaj Gupta, Wei Yang,
	Oscar Salvador, Michal Hocko, Dan Williams, Anshuman Khandual,
	Dave Hansen, Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki,
	Len Brown, Pavel Tatashin, Heiko Carstens, Michael Ellerman,
	Catalin Marinas, virtualization, linux-acpi, Andy Lutomirski,
	Aneesh Kumar K.V, Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato

We allocate + initialize everything from scratch. In case enabling the
device fails, we free all memory resourcs.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 drivers/acpi/acpi_memhotplug.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 1d01d9414c40..eb4faf7c5cad 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -182,10 +182,6 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 	 * (i.e. memory-hot-remove function)
 	 */
 	list_for_each_entry(info, &mem_device->res_list, list) {
-		if (info->enabled) { /* just sanity check...*/
-			num_enabled++;
-			continue;
-		}
 		/*
 		 * If the memory block size is zero, please ignore it.
 		 * Don't try to do the following memory hotplug flowchart.
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
  2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
@ 2021-07-14 20:13   ` Heiko Carstens
  2021-07-15  9:42     ` David Hildenbrand
  2021-07-14 20:41   ` Pankaj Gupta
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Heiko Carstens @ 2021-07-14 20:13 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-mm, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Pankaj Gupta, Wei Yang,
	Oscar Salvador, Michal Hocko, Dan Williams, Anshuman Khandual,
	Dave Hansen, Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki,
	Len Brown, Pavel Tatashin, Michael Ellerman, Catalin Marinas,
	virtualization, linux-acpi, Andy Lutomirski, Aneesh Kumar K.V,
	Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato

On Mon, Jul 12, 2021 at 02:40:49PM +0200, David Hildenbrand wrote:
> Checkpatch complained on a follow-up patch that we are using "unsigned"
> here, which defaults to "unsigned int" and checkpatch is correct.
> 
> 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 <david@redhat.com>
> ---
>  include/linux/memory_hotplug.h | 4 ++--
>  mm/memory_hotplug.c            | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

I'd propose to add Cc: <stable@vger.kernel.org> since I actually had
the fun to try to debug something like this a couple of years ago:
6cdb18ad98a4 ("mm/vmstat: fix overflow in mod_zone_page_state()")

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
  2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
  2021-07-14 20:13   ` Heiko Carstens
@ 2021-07-14 20:41   ` Pankaj Gupta
  2021-07-15  9:31   ` Oscar Salvador
  2021-07-15  9:34   ` Muchun Song
  3 siblings, 0 replies; 12+ messages in thread
From: Pankaj Gupta @ 2021-07-14 20:41 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: LKML, Linux MM, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Wei Yang, Oscar Salvador,
	Michal Hocko, Dan Williams, Anshuman Khandual, Dave Hansen,
	Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki, Len Brown,
	Pavel Tatashin, Heiko Carstens, Michael Ellerman,
	Catalin Marinas, virtualization, linux-acpi, Andy Lutomirski,
	Aneesh Kumar K.V, Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato

> Checkpatch complained on a follow-up patch that we are using "unsigned"
> here, which defaults to "unsigned int" and checkpatch is correct.
>
> 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 <david@redhat.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 a7fd2c3ccb77..d01b504ce06f 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -339,8 +339,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);
>  extern int arch_create_linear_mapping(int nid, u64 start, u64 size,
>                                       struct mhp_params *params);
>  void arch_remove_linear_mapping(u64 start, u64 size);
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 8cb75b26ea4f..93b3abaf9828 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -708,8 +708,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);

Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory()
  2021-07-12 12:40 ` [PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory() David Hildenbrand
@ 2021-07-14 20:47   ` Pankaj Gupta
  0 siblings, 0 replies; 12+ messages in thread
From: Pankaj Gupta @ 2021-07-14 20:47 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: LKML, Linux MM, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Wei Yang, Oscar Salvador,
	Michal Hocko, Dan Williams, Anshuman Khandual, Dave Hansen,
	Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki, Len Brown,
	Pavel Tatashin, Heiko Carstens, Michael Ellerman,
	Catalin Marinas, virtualization, linux-acpi, Andy Lutomirski,
	Aneesh Kumar K.V, Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	linux-arm-kernel, linux-ia64, linuxppc-dev, linux-s390, linux-sh

> The parameter is unused, let's remove it.
>
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
> Acked-by: Heiko Carstens <hca@linux.ibm.com> (s390)
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
> Cc: Baoquan He <bhe@redhat.com>
> Cc: Laurent Dufour <ldufour@linux.ibm.com>
> Cc: Sergei Trofimovich <slyfox@gentoo.org>
> Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
> Cc: Michel Lespinasse <michel@lespinasse.org>
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
> Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>
> Cc: Joe Perches <joe@perches.com>
> Cc: Pierre Morel <pmorel@linux.ibm.com>
> Cc: Jia He <justin.he@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-ia64@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-s390@vger.kernel.org
> Cc: linux-sh@vger.kernel.org
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/arm64/mm/mmu.c            | 3 +--
>  arch/ia64/mm/init.c            | 3 +--
>  arch/powerpc/mm/mem.c          | 3 +--
>  arch/s390/mm/init.c            | 3 +--
>  arch/sh/mm/init.c              | 3 +--
>  arch/x86/mm/init_32.c          | 3 +--
>  arch/x86/mm/init_64.c          | 3 +--
>  include/linux/memory_hotplug.h | 3 +--
>  mm/memory_hotplug.c            | 4 ++--
>  mm/memremap.c                  | 5 +----
>  10 files changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index d74586508448..af8ab553a268 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -1506,8 +1506,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return ret;
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index 064a967a7b6e..5c6da8d83c1a 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -484,8 +484,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return ret;
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index ad198b439222..c3c4e31462ec 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -119,8 +119,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
>         return rc;
>  }
>
> -void __ref arch_remove_memory(int nid, u64 start, u64 size,
> -                             struct vmem_altmap *altmap)
> +void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
> index 8ac710de1ab1..d85bd7f5d8dc 100644
> --- a/arch/s390/mm/init.c
> +++ b/arch/s390/mm/init.c
> @@ -306,8 +306,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return rc;
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
> index ce26c7f8950a..506784702430 100644
> --- a/arch/sh/mm/init.c
> +++ b/arch/sh/mm/init.c
> @@ -414,8 +414,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return ret;
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = PFN_DOWN(start);
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 74b78840182d..bd90b8fe81e4 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -801,8 +801,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return __add_pages(nid, start_pfn, nr_pages, params);
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index ddeaba947eb3..a6e11763763f 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -1255,8 +1255,7 @@ kernel_physical_mapping_remove(unsigned long start, unsigned long end)
>         remove_pagetable(start, end, true, NULL);
>  }
>
> -void __ref arch_remove_memory(int nid, u64 start, u64 size,
> -                             struct vmem_altmap *altmap)
> +void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index d01b504ce06f..010a192298b5 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -130,8 +130,7 @@ static inline bool movable_node_is_enabled(void)
>         return movable_node_enabled;
>  }
>
> -extern void arch_remove_memory(int nid, u64 start, u64 size,
> -                              struct vmem_altmap *altmap);
> +extern void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap);
>  extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages,
>                            struct vmem_altmap *altmap);
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 93b3abaf9828..f2a9af3af184 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1106,7 +1106,7 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
>         /* create memory block devices after memory was added */
>         ret = create_memory_block_devices(start, size, mhp_altmap.alloc);
>         if (ret) {
> -               arch_remove_memory(nid, start, size, NULL);
> +               arch_remove_memory(start, size, NULL);
>                 goto error;
>         }
>
> @@ -1892,7 +1892,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
>
>         mem_hotplug_begin();
>
> -       arch_remove_memory(nid, start, size, altmap);
> +       arch_remove_memory(start, size, altmap);
>
>         if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) {
>                 memblock_free(start, size);
> diff --git a/mm/memremap.c b/mm/memremap.c
> index 15a074ffb8d7..ed593bf87109 100644
> --- a/mm/memremap.c
> +++ b/mm/memremap.c
> @@ -140,14 +140,11 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id)
>  {
>         struct range *range = &pgmap->ranges[range_id];
>         struct page *first_page;
> -       int nid;
>
>         /* make sure to access a memmap that was actually initialized */
>         first_page = pfn_to_page(pfn_first(pgmap, range_id));
>
>         /* pages are dead and unused, undo the arch mapping */
> -       nid = page_to_nid(first_page);
> -
>         mem_hotplug_begin();
>         remove_pfn_range_from_zone(page_zone(first_page), PHYS_PFN(range->start),
>                                    PHYS_PFN(range_len(range)));
> @@ -155,7 +152,7 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id)
>                 __remove_pages(PHYS_PFN(range->start),
>                                PHYS_PFN(range_len(range)), NULL);
>         } else {
> -               arch_remove_memory(nid, range->start, range_len(range),
> +               arch_remove_memory(range->start, range_len(range),
>                                 pgmap_altmap(pgmap));
>                 kasan_remove_zero_shadow(__va(range->start), range_len(range));
>         }

Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
  2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
  2021-07-14 20:13   ` Heiko Carstens
  2021-07-14 20:41   ` Pankaj Gupta
@ 2021-07-15  9:31   ` Oscar Salvador
  2021-07-15  9:34   ` Muchun Song
  3 siblings, 0 replies; 12+ messages in thread
From: Oscar Salvador @ 2021-07-15  9:31 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-mm, Andrew Morton, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Pankaj Gupta, Wei Yang,
	Michal Hocko, Dan Williams, Anshuman Khandual, Dave Hansen,
	Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki, Len Brown,
	Pavel Tatashin, Heiko Carstens, Michael Ellerman,
	Catalin Marinas, virtualization, linux-acpi, Andy Lutomirski,
	Aneesh Kumar K.V, Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato

On Mon, Jul 12, 2021 at 02:40:49PM +0200, David Hildenbrand wrote:
> Checkpatch complained on a follow-up patch that we are using "unsigned"
> here, which defaults to "unsigned int" and checkpatch is correct.
> 
> 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 <david@redhat.com>

Reviewed-by: Oscar Salvador <osalvador@suse.de>

-- 
Oscar Salvador
SUSE L3

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
  2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
                     ` (2 preceding siblings ...)
  2021-07-15  9:31   ` Oscar Salvador
@ 2021-07-15  9:34   ` Muchun Song
  3 siblings, 0 replies; 12+ messages in thread
From: Muchun Song @ 2021-07-15  9:34 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: LKML, Linux Memory Management List, Andrew Morton,
	Vitaly Kuznetsov, Michael S. Tsirkin, Jason Wang, Pankaj Gupta,
	Wei Yang, Oscar Salvador, Michal Hocko, Dan Williams,
	Anshuman Khandual, Dave Hansen, Vlastimil Babka, Mike Rapoport,
	Rafael J. Wysocki, Len Brown, Pavel Tatashin, Heiko Carstens,
	Michael Ellerman, Catalin Marinas, virtualization, linux-acpi,
	Andy Lutomirski, Aneesh Kumar K.V, Anton Blanchard,
	Ard Biesheuvel, Baoquan He, Benjamin Herrenschmidt,
	Borislav Petkov, Christian Borntraeger, Christophe Leroy,
	Dave Jiang, H. Peter Anvin, Ingo Molnar, Jia He, Joe Perches,
	Kefeng Wang, Laurent Dufour, Michel Lespinasse, Nathan Lynch,
	Nicholas Piggin, Paul Mackerras, Peter Zijlstra, Pierre Morel,
	Rafael J. Wysocki, Rich Felker, Scott Cheloha,
	Sergei Trofimovich, Thiago Jung Bauermann, Thomas Gleixner,
	Vasily Gorbik, Vishal Verma, Will Deacon, Yoshinori Sato

On Mon, Jul 12, 2021 at 8:42 PM David Hildenbrand <david@redhat.com> wrote:
>
> Checkpatch complained on a follow-up patch that we are using "unsigned"
> here, which defaults to "unsigned int" and checkpatch is correct.
>
> 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 <david@redhat.com>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
  2021-07-14 20:13   ` Heiko Carstens
@ 2021-07-15  9:42     ` David Hildenbrand
  2021-07-15 18:12       ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: David Hildenbrand @ 2021-07-15  9:42 UTC (permalink / raw)
  To: Heiko Carstens, Andrew Morton
  Cc: linux-kernel, linux-mm, Vitaly Kuznetsov, Michael S. Tsirkin,
	Jason Wang, Pankaj Gupta, Wei Yang, Oscar Salvador, Michal Hocko,
	Dan Williams, Anshuman Khandual, Dave Hansen, Vlastimil Babka,
	Mike Rapoport, Rafael J. Wysocki, Len Brown, Pavel Tatashin,
	Michael Ellerman, Catalin Marinas, virtualization, linux-acpi,
	Andy Lutomirski, Aneesh Kumar K.V, Anton Blanchard,
	Ard Biesheuvel, Baoquan He, Benjamin Herrenschmidt,
	Borislav Petkov, Christian Borntraeger, Christophe Leroy,
	Dave Jiang, H. Peter Anvin, Ingo Molnar, Jia He, Joe Perches,
	Kefeng Wang, Laurent Dufour, Michel Lespinasse, Nathan Lynch,
	Nicholas Piggin, Paul Mackerras, Peter Zijlstra, Pierre Morel,
	Rafael J. Wysocki, Rich Felker, Scott Cheloha,
	Sergei Trofimovich, Thiago Jung Bauermann, Thomas Gleixner,
	Vasily Gorbik, Vishal Verma, Will Deacon, Yoshinori Sato

On 14.07.21 22:13, Heiko Carstens wrote:
> On Mon, Jul 12, 2021 at 02:40:49PM +0200, David Hildenbrand wrote:
>> Checkpatch complained on a follow-up patch that we are using "unsigned"
>> here, which defaults to "unsigned int" and checkpatch is correct.
>>
>> 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 <david@redhat.com>
>> ---
>>   include/linux/memory_hotplug.h | 4 ++--
>>   mm/memory_hotplug.c            | 4 ++--
>>   2 files changed, 4 insertions(+), 4 deletions(-)
> 
> I'd propose to add Cc: <stable@vger.kernel.org> since I actually had
> the fun to try to debug something like this a couple of years ago:
> 6cdb18ad98a4 ("mm/vmstat: fix overflow in mod_zone_page_state()")
> 

Good point, and thinking again what can go wrong, I tend to agree. We 
are trying to keep zones contiguous and it could happen that we end up 
with something like ZONE_DMA here (via default_kernel_zone_for_pfn()) 
and would consequently online something to ZONE_DMA that doesn't belong 
there, resulting in crashes.

@Andrew can you add  Cc: <stable@vger.kernel.org> and

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

Thanks Heiko!

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
  2021-07-15  9:42     ` David Hildenbrand
@ 2021-07-15 18:12       ` Andrew Morton
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2021-07-15 18:12 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Heiko Carstens, linux-kernel, linux-mm, Vitaly Kuznetsov,
	Michael S. Tsirkin, Jason Wang, Pankaj Gupta, Wei Yang,
	Oscar Salvador, Michal Hocko, Dan Williams, Anshuman Khandual,
	Dave Hansen, Vlastimil Babka, Mike Rapoport, Rafael J. Wysocki,
	Len Brown, Pavel Tatashin, Michael Ellerman, Catalin Marinas,
	virtualization, linux-acpi, Andy Lutomirski, Aneesh Kumar K.V,
	Anton Blanchard, Ard Biesheuvel, Baoquan He,
	Benjamin Herrenschmidt, Borislav Petkov, Christian Borntraeger,
	Christophe Leroy, Dave Jiang, H. Peter Anvin, Ingo Molnar,
	Jia He, Joe Perches, Kefeng Wang, Laurent Dufour,
	Michel Lespinasse, Nathan Lynch, Nicholas Piggin, Paul Mackerras,
	Peter Zijlstra, Pierre Morel, Rafael J. Wysocki, Rich Felker,
	Scott Cheloha, Sergei Trofimovich, Thiago Jung Bauermann,
	Thomas Gleixner, Vasily Gorbik, Vishal Verma, Will Deacon,
	Yoshinori Sato

On Thu, 15 Jul 2021 11:42:21 +0200 David Hildenbrand <david@redhat.com> wrote:

> > I'd propose to add Cc: <stable@vger.kernel.org> since I actually had
> > the fun to try to debug something like this a couple of years ago:
> > 6cdb18ad98a4 ("mm/vmstat: fix overflow in mod_zone_page_state()")
> > 
> 
> Good point, and thinking again what can go wrong, I tend to agree. We 
> are trying to keep zones contiguous and it could happen that we end up 
> with something like ZONE_DMA here (via default_kernel_zone_for_pfn()) 
> and would consequently online something to ZONE_DMA that doesn't belong 
> there, resulting in crashes.
> 
> @Andrew can you add  Cc: <stable@vger.kernel.org> and
> 
> "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."

Yep, all done.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-07-15 18:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 12:40 mm/memory_hotplug: preparatory patches for new online policy and memory David Hildenbrand
2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
2021-07-14 20:13   ` Heiko Carstens
2021-07-15  9:42     ` David Hildenbrand
2021-07-15 18:12       ` Andrew Morton
2021-07-14 20:41   ` Pankaj Gupta
2021-07-15  9:31   ` Oscar Salvador
2021-07-15  9:34   ` Muchun Song
2021-07-12 12:40 ` [PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory() David Hildenbrand
2021-07-14 20:47   ` Pankaj Gupta
2021-07-12 12:40 ` [PATCH v1 3/4] mm/memory_hotplug: remove nid parameter from remove_memory() and friends David Hildenbrand
2021-07-12 12:40 ` [PATCH v1 4/4] ACPI: memhotplug: memory resources cannot be enabled yet 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).