Skip to contentSkip to conversation

powerpc-book3s64-vmemmap-switch-radix-to-use-a-different-vmemmap-handling-function.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Aug 11, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: powerpc/book3s64/vmemmap: switch radix to use a different vmemmap handling function
has been removed from the -mm tree. Its filename was
powerpc-book3s64-vmemmap-switch-radix-to-use-a-different-vmemmap-handling-function.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Aneesh Kumar K.V" <[email protected]>
Subject: powerpc/book3s64/vmemmap: switch radix to use a different vmemmap handling function
Date: Tue, 25 Jul 2023 00:37:56 +0530

This is in preparation to update radix to implement vmemmap optimization for devdax. Below are the rules w.r.t radix vmemmap mapping

1. First try to map things using PMD (2M)
2. With altmap if altmap cross-boundary check returns true, fall back to PAGE_SIZE
3. If we can't allocate PMD_SIZE backing memory for vmemmap, fallback to PAGE_SIZE

On removing vmemmap mapping, check if every subsection that is using the vmemmap area is invalid. If found to be invalid, that implies we can safely free the vmemmap area. We don't use the PAGE_UNUSED pattern used by x86 because with 64K page size, we need to do the above check even at the PAGE_SIZE granularity.

[[email protected]: fix section mismatch warning]
[[email protected]: fix kernel build error]
Cc Catalin Marinas <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Joao Martins <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Muchun Song <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Will Deacon <[email protected]>

---

 arch/powerpc/include/asm/book3s/64/radix.h |    2 
 arch/powerpc/include/asm/pgtable.h         |    6 
 arch/powerpc/mm/book3s64/radix_pgtable.c   |  327 +++++++++++++++++--
 arch/powerpc/mm/init_64.c                  |   26 +
 4 files changed, 329 insertions(+), 32 deletions(-)
arch/powerpc/include/asm/book3s/64/radix.h renamed from arch/powerpc/include/asm/book3s/64/radix.h~powerpc-book3s64-vmemmap-switch-radix-to-use-a-different-vmemmap-handling-function +2 -0
@@ -331,6 +331,8 @@ extern int __meminit radix__vmemmap_crea
 					     unsigned long phys);
 int __meminit radix__vmemmap_populate(unsigned long start, unsigned long end,
 				      int node, struct vmem_altmap *altmap);
+void __ref radix__vmemmap_free(unsigned long start, unsigned long end,
+			       struct vmem_altmap *altmap);
 extern void radix__vmemmap_remove_mapping(unsigned long start,
 				    unsigned long page_size);
 
arch/powerpc/include/asm/pgtable.h renamed from arch/powerpc/include/asm/pgtable.h~powerpc-book3s64-vmemmap-switch-radix-to-use-a-different-vmemmap-handling-function +6 -0
@@ -157,6 +157,12 @@ static inline pgtable_t pmd_pgtable(pmd_
 	return (pgtable_t)pmd_page_vaddr(pmd);
 }
 
+#ifdef CONFIG_PPC64
+int __meminit vmemmap_populated(unsigned long vmemmap_addr, int vmemmap_map_size);
+bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long start,
+			   unsigned long page_size);
+#endif /* CONFIG_PPC64 */
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_POWERPC_PGTABLE_H */
arch/powerpc/mm/book3s64/radix_pgtable.c renamed from arch/powerpc/mm/book3s64/radix_pgtable.c~powerpc-book3s64-vmemmap-switch-radix-to-use-a-different-vmemmap-handling-function +300 -27

396 lines not on this page · raw message

arch/powerpc/mm/init_64.c renamed from arch/powerpc/mm/init_64.c~powerpc-book3s64-vmemmap-switch-radix-to-use-a-different-vmemmap-handling-function +21 -5
@@ -92,7 +92,7 @@ static struct page * __meminit vmemmap_s
  * a page table lookup here because with the hash translation we don't keep
  * vmemmap details in linux page table.
  */
-static int __meminit vmemmap_populated(unsigned long vmemmap_addr, int vmemmap_map_size)
+int __meminit vmemmap_populated(unsigned long vmemmap_addr, int vmemmap_map_size)
 {
 	struct page *start;
 	unsigned long vmemmap_end = vmemmap_addr + vmemmap_map_size;
@@ -183,8 +183,8 @@ static __meminit int vmemmap_list_popula
 	return 0;
 }
 
-static bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long start,
-				unsigned long page_size)
+bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long start,
+			   unsigned long page_size)
 {
 	unsigned long nr_pfn = page_size / sizeof(struct page);
 	unsigned long start_pfn = page_to_pfn((struct page *)start);
@@ -204,6 +204,11 @@ int __meminit vmemmap_populate(unsigned
 	bool altmap_alloc;
 	unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
 
+#ifdef CONFIG_PPC_BOOK3S_64
+	if (radix_enabled())
+		return radix__vmemmap_populate(start, end, node, altmap);
+#endif
+
 	/* Align to the page size of the linear mapping. */
 	start = ALIGN_DOWN(start, page_size);
 
@@ -303,8 +308,8 @@ static unsigned long vmemmap_list_free(u
 	return vmem_back->phys;
 }
 
-void __ref vmemmap_free(unsigned long start, unsigned long end,
-		struct vmem_altmap *altmap)
+static void __ref __vmemmap_free(unsigned long start, unsigned long end,
+				 struct vmem_altmap *altmap)
 {
 	unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
 	unsigned long page_order = get_order(page_size);
@@ -362,6 +367,17 @@ void __ref vmemmap_free(unsigned long st
 		vmemmap_remove_mapping(start, page_size);
 	}
 }
+
+void __ref vmemmap_free(unsigned long start, unsigned long end,
+			struct vmem_altmap *altmap)
+{
+#ifdef CONFIG_PPC_BOOK3S_64
+	if (radix_enabled())
+		return radix__vmemmap_free(start, end, altmap);
+#endif
+	return __vmemmap_free(start, end, altmap);
+}
+
 #endif
 void register_page_bootmem_memmap(unsigned long section_nr,
 				  struct page *start_page, unsigned long size)

_

Patches currently in -mm which might be from [email protected] are

mm-memory_hotplug-simplify-arch_mhp_memmap_on_memory_enable-kconfig.patch mm-memory_hotplug-allow-memmap-on-memory-hotplug-request-to-fallback.patch mm-memory_hotplug-allow-architecture-to-override-memmap-on-memory-support-check.patch mm-memory_hotplug-support-memmap_on_memory-when-memmap-is-not-aligned-to-pageblocks.patch powerpc-book3s64-memhotplug-enable-memmap-on-memory-for-radix.patch mm-memory_hotplug-embed-vmem_altmap-details-in-memory-block.patch