mm-introduce-deferred-freeing-for-kernel-page-tables.patch removed from -mm tree
The quilt patch titled
Subject: mm: introduce deferred freeing for kernel page tables
has been removed from the -mm tree. Its filename was
mm-introduce-deferred-freeing-for-kernel-page-tables.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: Dave Hansen <[email protected]>
Subject: mm: introduce deferred freeing for kernel page tables
Date: Wed, 22 Oct 2025 16:26:33 +0800
This introduces a conditional asynchronous mechanism, enabled by CONFIG_ASYNC_KERNEL_PGTABLE_FREE. When enabled, this mechanism defers the freeing of pages that are used as page tables for kernel address mappings. These pages are now queued to a work struct instead of being freed immediately.
This deferred freeing allows for batch-freeing of page tables, providing a safe context for performing a single expensive operation (TLB flush) for a batch of kernel page tables instead of performing that expensive operation for each page table.
---
include/linux/mm.h | 16 +++++++++++++--- mm/Kconfig | 3 +++ mm/pgtable-generic.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-introduce-deferred-freeing-for-kernel-page-tables +13 -3
@@ -3053,6 +3053,14 @@ static inline void __pagetable_free(stru__free_pages (page,compound_order (page)); } +#ifdef CONFIG_ASYNC_KERNEL_PGTABLE_FREE +void pagetable_free_kernel (struct ptdesc *pt); +#else +static inline void pagetable_free_kernel (struct ptdesc *pt) +{ +__pagetable_free (pt); +} +#endif /** * pagetable_free - Free pagetables * @pt: The page table descriptor
@@ -3062,10 +3070,12 @@ static inline void __pagetable_free(stru*/ static inline void pagetable_free (struct ptdesc *pt) { -if (ptdesc_test_kernel (pt)) +if (ptdesc_test_kernel (pt)) {ptdesc_clear_kernel (pt); - -__pagetable_free (pt); +pagetable_free_kernel (pt); + }else { +__pagetable_free (pt); + } }#if defined(CONFIG_SPLIT_PTE_PTLOCKS )
mm/Kconfig renamed from mm/Kconfig~mm-introduce-deferred-freeing-for-kernel-page-tables +3 -0
@@ -906,6 +906,9 @@ config HAVE_GIGANTIC_FOLIOS def_bool (HUGETLB_PAGE && ARCH_HAS_GIGANTIC_PAGE) || \ (ZONE_DEVICE && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) +config ASYNC_KERNEL_PGTABLE_FREE + def_bool n + # TODO: Allow to be enabled without THP config ARCH_SUPPORTS_HUGE_PFNMAP def_bool n
mm/pgtable-generic.c renamed from mm/pgtable-generic.c~mm-introduce-deferred-freeing-for-kernel-page-tables +37 -0
@@ -406,3 +406,40 @@ again:pte_unmap_unlock (pte, ptl); goto again; } + +#ifdef CONFIG_ASYNC_KERNEL_PGTABLE_FREE +static void kernel_pgtable_work_func (struct work_struct *work); + +static struct { +struct list_head list; +/* protect above ptdesc lists */ +spinlock_t lock; +struct work_struct work; +} kernel_pgtable_work = { + .list =LIST_HEAD_INIT (kernel_pgtable_work.list), + .lock =__SPIN_LOCK_UNLOCKED (kernel_pgtable_work.lock), + .work =__WORK_INITIALIZER (kernel_pgtable_work.work, kernel_pgtable_work_func), +}; + +static void kernel_pgtable_work_func (struct work_struct *work) +{ +struct ptdesc *pt, *next; +LIST_HEAD (page_list); + +spin_lock (&kernel_pgtable_work.lock); +list_splice_tail_init (&kernel_pgtable_work.list, &page_list); +spin_unlock (&kernel_pgtable_work.lock); + +list_for_each_entry_safe (pt, next, &page_list, pt_list) +__pagetable_free (pt); +} + +void pagetable_free_kernel (struct ptdesc *pt) +{ +spin_lock (&kernel_pgtable_work.lock); +list_add (&pt->pt_list, &kernel_pgtable_work.list); +spin_unlock (&kernel_pgtable_work.lock); + +schedule_work (&kernel_pgtable_work.work); +} +#endif
_
Patches currently in -mm which might be from [email protected] are