linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] mm: batched unmap lazyfree large folios during reclamation
@ 2025-01-06  3:17 Barry Song
  2025-01-06  3:17 ` [PATCH 1/3] mm: set folio swapbacked iff folios are dirty in try_to_unmap_one Barry Song
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Barry Song @ 2025-01-06  3:17 UTC (permalink / raw)
  To: akpm, linux-mm
  Cc: linux-arm-kernel, x86, linux-kernel, ioworker0, david,
	ryan.roberts, zhengtangquan, ying.huang, kasong, chrisl,
	baolin.wang, Barry Song

From: Barry Song <v-songbaohua@oppo.com>

Commit 735ecdfaf4e80 ("mm/vmscan: avoid splitting lazyfree THP during 
shrink_folio_list()") prevents the splitting of MADV_FREE'd THP in madvise.c. 
However, those folios are still added to the deferred_split list in 
try_to_unmap_one() because we are unmapping PTEs and removing rmap entries 
one by one. This approach is not only slow but also increases the risk of a 
race condition where lazyfree folios are incorrectly set back to swapbacked, 
as a speculative folio_get may occur in the shrinker's callback.

This patchset addresses the issue by only marking truly dirty folios as 
swapbacked as suggested by David and shifting to batched unmapping of the
entire folio in  try_to_unmap_one(). As a result, we've observed
deferred_split dropping to  zero and significant performance improvements
in memory reclamation.

Barry Song (3):
  mm: set folio swapbacked iff folios are dirty in try_to_unmap_one
  mm: Support tlbbatch flush for a range of PTEs
  mm: Support batched unmap for lazyfree large folios during reclamation

 arch/arm64/include/asm/tlbflush.h |  26 ++++----
 arch/arm64/mm/contpte.c           |   2 +-
 arch/x86/include/asm/tlbflush.h   |   3 +-
 mm/rmap.c                         | 103 ++++++++++++++++++++----------
 4 files changed, 85 insertions(+), 49 deletions(-)

-- 
2.39.3 (Apple Git-146)



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2025-01-13 13:13 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-06  3:17 [PATCH 0/3] mm: batched unmap lazyfree large folios during reclamation Barry Song
2025-01-06  3:17 ` [PATCH 1/3] mm: set folio swapbacked iff folios are dirty in try_to_unmap_one Barry Song
2025-01-06  6:40   ` Baolin Wang
2025-01-06  9:03     ` Barry Song
2025-01-06  9:34       ` Baolin Wang
2025-01-06 14:39         ` Lance Yang
2025-01-06 20:52           ` Barry Song
2025-01-06 20:56             ` Barry Song
2025-01-07  1:33           ` Lance Yang
2025-01-06  3:17 ` [PATCH 2/3] mm: Support tlbbatch flush for a range of PTEs Barry Song
2025-01-06  8:22   ` kernel test robot
2025-01-13  0:55     ` Barry Song
2025-01-13 13:13       ` Oliver Sang
2025-01-06 10:07   ` kernel test robot
2025-01-13  0:56     ` Barry Song
2025-01-13  7:30       ` Oliver Sang
2025-01-06  3:17 ` [PATCH 3/3] mm: Support batched unmap for lazyfree large folios during reclamation Barry Song
2025-01-06 17:28 ` [PATCH 0/3] mm: batched unmap " Lorenzo Stoakes
2025-01-06 19:15   ` Barry Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox