mm-vmemmap-improve-vmemmap_can_optimize-and-allow-architectures-to-override.patch removed from -mm tree
The quilt patch titled
Subject: mm/vmemmap: improve vmemmap_can_optimize and allow architectures to override
has been removed from the -mm tree. Its filename was
mm-vmemmap-improve-vmemmap_can_optimize-and-allow-architectures-to-override.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: mm/vmemmap: improve vmemmap_can_optimize and allow architectures to override
Date: Tue, 25 Jul 2023 00:37:49 +0530
dax vmemmap optimization requires a minimum of 2 PAGE_SIZE area within vmemmap such that tail page mapping can point to the second PAGE_SIZE area. Enforce that in vmemmap_can_optimize() function.
Architectures like powerpc also want to enable vmemmap optimization conditionally (only with radix MMU translation). Hence allow architecture override.
---
include/linux/mm.h | 27 +++++++++++++++++++++++---- mm/mm_init.c | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-vmemmap-improve-vmemmap_can_optimize-and-allow-architectures-to-override +23 -4
@@ -3632,13 +3632,32 @@ void vmemmap_free(unsigned long start, u struct vmem_altmap *altmap);#endif +#define VMEMMAP_RESERVE_NR 2#ifdef CONFIG_ARCH_WANT_OPTIMIZE_VMEMMAP -static inline bool vmemmap_can_optimize (struct vmem_altmap *altmap, -struct dev_pagemap *pgmap) +static inline bool __vmemmap_can_optimize (struct vmem_altmap *altmap, +struct dev_pagemap *pgmap) { -return is_power_of_2 (sizeof (struct page )) && - pgmap && (pgmap_vmemmap_nr (pgmap) >1 ) && !altmap; +unsigned long nr_pages; +unsigned long nr_vmemmap_pages; + +if (!pgmap || !is_power_of_2 (sizeof (struct page ))) +return false; + + nr_pages =pgmap_vmemmap_nr (pgmap); + nr_vmemmap_pages = ((nr_pages *sizeof (struct page )) >>PAGE_SHIFT ); +/* +* For vmemmap optimization with DAX we need minimum 2 vmemmap +* pages. See layout diagram in Documentation/mm/vmemmap_dedup.rst +*/ +return !altmap && (nr_vmemmap_pages >VMEMMAP_RESERVE_NR ); } +/* +* If we don't have an architecture override, use the generic rule +*/ +#ifndef vmemmap_can_optimize +#define vmemmap_can_optimize __vmemmap_can_optimize +#endif +#else static inline bool vmemmap_can_optimize (struct vmem_altmap *altmap,struct dev_pagemap *pgmap)
mm/mm_init.c renamed from mm/mm_init.c~mm-vmemmap-improve-vmemmap_can_optimize-and-allow-architectures-to-override +1 -1
@@ -1020,7 +1020,7 @@ static inline unsigned long compound_nr_if (!vmemmap_can_optimize (altmap, pgmap))return pgmap_vmemmap_nr (pgmap); -return 2 * (PAGE_SIZE /sizeof (struct page )); +return VMEMMAP_RESERVE_NR * (PAGE_SIZE /sizeof (struct page )); } static void __ref memmap_init_compound(struct page *head,
_
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