mm-vmscan-avoid-split-lazyfree-thp-during-shrink_folio_list.patch removed from -mm tree
The quilt patch titled
Subject: mm/vmscan: avoid split lazyfree THP during shrink_folio_list()
has been removed from the -mm tree. Its filename was
mm-vmscan-avoid-split-lazyfree-thp-during-shrink_folio_list.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: Lance Yang <[email protected]>
Subject: mm/vmscan: avoid split lazyfree THP during shrink_folio_list()
Date: Wed, 1 May 2024 12:27:00 +0800
When the user no longer requires the pages, they would use madvise(MADV_FREE) to mark the pages as lazy free. Subsequently, they typically would not re-write to that memory again.
During memory reclaim, if we detect that the large folio and its PMD are both still marked as clean and there are no unexpected references (such as GUP), so we can just discard the memory lazily, improving the efficiency of memory reclamation in this case. On an Intel i5 CPU, reclaiming 1GiB of lazyfree THPs using mem_cgroup_force_empty() results in the following runtimes in seconds (shorter is better):
--------------------------------------------
| Old | New | Change |
--------------------------------------------
| 0.683426 | 0.049197 | -92.80% |
--------------------------------------------
---
include/linux/huge_mm.h | 9 ++++ mm/huge_memory.c | 73 ++++++++++++++++++++++++++++++++++++++ mm/rmap.c | 3 + 3 files changed, 85 insertions(+)
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-vmscan-avoid-split-lazyfree-thp-during-shrink_folio_list +9 -0
@@ -411,6 +411,8 @@ static inline bool thp_migration_supportvoid split_huge_pmd_locked (struct vm_area_struct *vma,unsigned long address,pmd_t *pmd,bool freeze,struct folio *folio); +bool unmap_huge_pmd_locked (struct vm_area_struct *vma,unsigned long addr, +pmd_t *pmdp,struct folio *folio); static inline void align_huge_pmd_range(struct vm_area_struct *vma, unsigned long *start,
@@ -492,6 +494,13 @@ static inline void align_huge_pmd_range( unsigned long *start, unsigned long *end) {} +static inline bool unmap_huge_pmd_locked (struct vm_area_struct *vma, +unsigned long addr,pmd_t *pmdp, +struct folio *folio) +{ +return false; +} +#define split_huge_pud (__vma, __pmd, __address) \ do { } while (0)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-vmscan-avoid-split-lazyfree-thp-during-shrink_folio_list +73 -0
79 lines not on this page · raw message
mm/rmap.c renamed from mm/rmap.c~mm-vmscan-avoid-split-lazyfree-thp-during-shrink_folio_list +3 -0
@@ -1676,6 +1676,9 @@ static bool try_to_unmap_one(struct foli }if (!pvmw.pte && (flags &TTU_SPLIT_HUGE_PMD )) { +if (unmap_huge_pmd_locked (vma, range.start, pvmw.pmd, + folio)) + goto walk_done;/* * We temporarily have to drop the PTL and start once * again from that now-PTE-mapped page table.
_
Patches currently in -mm which might be from [email protected] are