mm-thp-refactor-numa-fault-handling.patch removed from -mm tree
The patch titled
Subject: mm: thp: refactor NUMA fault handling
has been removed from the -mm tree. Its filename was
mm-thp-refactor-numa-fault-handling.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Yang Shi <[email protected]>
Subject: mm: thp: refactor NUMA fault handling
When the THP NUMA fault support was added THP migration was not supported yet. So the ad hoc THP migration was implemented in NUMA fault handling. Since v4.14 THP migration has been supported so it doesn't make too much sense to still keep another THP migration implementation rather than using the generic migration code.
This patch reworks the NUMA fault handling to use generic migration implementation to migrate misplaced page. There is no functional change.
After the refactor the flow of NUMA fault handling looks just like its PTE counterpart:
Acquire ptl
Prepare for migration (elevate page refcount)
Release ptl
Isolate page from lru and elevate page refcount
Migrate the misplaced THP
If migration fails just restore the old normal PMD.
In the old code anon_vma lock was needed to serialize THP migration against THP split, but since then the THP code has been reworked a lot, it seems anon_vma lock is not required anymore to avoid the race.
The page refcount elevation when holding ptl should prevent from THP split.
Use migrate_misplaced_page() for both base page and THP NUMA hinting fault and remove all the dead and duplicate code.
---
include/linux/migrate.h | 23 ---- mm/huge_memory.c | 145 +++++++++---------------------- mm/internal.h | 18 --- mm/migrate.c | 177 +++++++------------------------------- 4 files changed, 77 insertions(+), 286 deletions(-)
include/linux/migrate.h renamed from include/linux/migrate.h~mm-thp-refactor-numa-fault-handling +0 -23
@@ -99,14 +99,9 @@ static inline void __ClearPageMovable(st#endif #ifdef CONFIG_NUMA_BALANCING -extern bool pmd_trans_migrating (pmd_t pmd);extern int migrate_misplaced_page (struct page *page,struct vm_area_struct *vma,int node);#else -static inline bool pmd_trans_migrating (pmd_t pmd) -{ -return false; -}static inline int migrate_misplaced_page (struct page *page,struct vm_area_struct *vma,int node) {
@@ -114,24 +109,6 @@ static inline int migrate_misplaced_page }#endif /* CONFIG_NUMA_BALANCING */ -#if defined(CONFIG_NUMA_BALANCING ) && defined(CONFIG_TRANSPARENT_HUGEPAGE ) -extern int migrate_misplaced_transhuge_page (struct mm_struct *mm, -struct vm_area_struct *vma, -pmd_t *pmd,pmd_t entry, -unsigned long address, -struct page *page,int node); -#else -static inline int migrate_misplaced_transhuge_page (struct mm_struct *mm, -struct vm_area_struct *vma, -pmd_t *pmd,pmd_t entry, -unsigned long address, -struct page *page,int node) -{ -return -EAGAIN ; -} -#endif /* CONFIG_NUMA_BALANCING && CONFIG_TRANSPARENT_HUGEPAGE*/ - -#ifdef CONFIG_MIGRATION /*
mm/huge_memory.c renamed from mm/huge_memory.c~mm-thp-refactor-numa-fault-handling +44 -101
181 lines not on this page · raw message
mm/internal.h renamed from mm/internal.h~mm-thp-refactor-numa-fault-handling +0 -18
@@ -369,23 +369,6 @@ extern unsigned int munlock_vma_page(str*/ extern void clear_page_mlock (struct page *page); -/* -* mlock_migrate_page - called only from migrate_misplaced_transhuge_page() -* (because that does not go through the full procedure of migration ptes): -* to migrate the Mlocked page flag; update statistics. -*/ -static inline void mlock_migrate_page (struct page *newpage,struct page *page) -{ -if (TestClearPageMlocked (page)) { -int nr_pages =thp_nr_pages (page); - -/* Holding pmd lock, no change in irq context: __mod is safe */ -__mod_zone_page_state (page_zone (page),NR_MLOCK , -nr_pages); -SetPageMlocked (newpage); -__mod_zone_page_state (page_zone (newpage),NR_MLOCK , nr_pages); - } -} -extern pmd_t maybe_pmd_mkwrite (pmd_t pmd,struct vm_area_struct *vma);/*
@@ -461,7 +444,6 @@ static inline struct file *maybe_unlock_#else /* !CONFIG_MMU */ static inline void clear_page_mlock (struct page *page) { }static inline void mlock_vma_page (struct page *page) { } -static inline void mlock_migrate_page (struct page *new,struct page *old) { }static inline void vunmap_range_noflush (unsigned long start,unsigned long end) { }
mm/migrate.c renamed from mm/migrate.c~mm-thp-refactor-numa-fault-handling +33 -144
207 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are