mm-pgtable-add-pte_free_defer-for-pgtable-as-page.patch removed from -mm tree
The quilt patch titled
Subject: mm/pgtable: add pte_free_defer() for pgtable as page
has been removed from the -mm tree. Its filename was
mm-pgtable-add-pte_free_defer-for-pgtable-as-page.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: Hugh Dickins <[email protected]>
Subject: mm/pgtable: add pte_free_defer() for pgtable as page
Date: Tue, 11 Jul 2023 21:39:48 -0700 (PDT)
Add the generic pte_free_defer(), to call pte_free() via call_rcu(). pte_free_defer() will be called inside khugepaged's retract_page_tables() loop, where allocating extra memory cannot be relied upon. This version suits all those architectures which use an unfragmented page for one page table (none of whose pte_free()s use the mm arg which was passed to it).
---
include/linux/mm_types.h | 4 ++++ include/linux/pgtable.h | 2 ++ mm/pgtable-generic.c | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+)
include/linux/mm_types.h renamed from include/linux/mm_types.h~mm-pgtable-add-pte_free_defer-for-pgtable-as-page +4 -0
@@ -144,6 +144,10 @@ struct page {struct {/* Page table pages */ unsigned long _pt_pad_1;/* compound_head */ pgtable_t pmd_huge_pte;/* protected by page->ptl */ +/* +* A PTE page table page might be freed by use of +* rcu_head: which overlays those two fields above. +*/ unsigned long _pt_pad_2;/* mapping */ union {struct mm_struct *pt_mm;/* x86 pgds only */
include/linux/pgtable.h renamed from include/linux/pgtable.h~mm-pgtable-add-pte_free_defer-for-pgtable-as-page +2 -0
@@ -112,6 +112,8 @@ static inline void pte_unmap(pte_t *pte) }#endif +void pte_free_defer (struct mm_struct *mm,pgtable_t pgtable); +/* Find an entry in the second-level page table.. */ #ifndef pmd_offsetstatic inline pmd_t *pmd_offset (pud_t *pud,unsigned long address)
mm/pgtable-generic.c renamed from mm/pgtable-generic.c~mm-pgtable-add-pte_free_defer-for-pgtable-as-page +20 -0
@@ -13,6 +13,7 @@#include <linux/swap.h> #include <linux/swapops.h> #include <linux/mm_inline.h> +#include <asm/pgalloc.h> #include <asm/tlb.h> /*
@@ -230,6 +231,25 @@ pmd_t pmdp_collapse_flush(struct vm_areareturn pmd; }#endif + +/* arch define pte_free_defer in asm/pgalloc.h for its own implementation */ +#ifndef pte_free_defer +static void pte_free_now (struct rcu_head *head) +{ +struct page *page; + + page = container_of(head, struct page, rcu_head); +pte_free (NULL /* mm not passed and not used */ , (pgtable_t )page); +} + +void pte_free_defer (struct mm_struct *mm,pgtable_t pgtable) +{ +struct page *page; + + page = pgtable; +call_rcu (&page->rcu_head, pte_free_now); +} +#endif /* pte_free_defer */ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #if defined(CONFIG_GUP_GET_PXX_LOW_HIGH) && \
_
Patches currently in -mm which might be from [email protected] are