linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/1] mm: vmascan: retry folios written back while isolated for traditional LRU
@ 2024-12-09  8:36 Chen Ridong
  2024-12-09  8:36 ` [PATCH v4 1/1] " Chen Ridong
  2024-12-10  2:13 ` [PATCH v4 0/1] " Andrew Morton
  0 siblings, 2 replies; 10+ messages in thread
From: Chen Ridong @ 2024-12-09  8:36 UTC (permalink / raw)
  To: akpm, mhocko, hannes, yosryahmed, yuzhao, david, willy,
	ryan.roberts, baohua, 21cnbao, wangkefeng.wang
  Cc: linux-mm, linux-kernel, chenridong, wangweiyang2, xieym_ict

From: Chen Ridong <chenridong@huawei.com>

The commit 359a5e1416ca ("mm: multi-gen LRU: retry folios written back
while isolated") only fixed the issue for mglru. However, this issue
also exists in the traditional active/inactive LRU. Fix this issue
in the same way for active/inactive lru.

What is fixed:
The page reclaim isolates a batch of folios from the tail of one of the
LRU lists and works on those folios one by one.  For a suitable
swap-backed folio, if the swap device is async, it queues that folio for
writeback.  After the page reclaim finishes an entire batch, it puts back
the folios it queued for writeback to the head of the original LRU list.

In the meantime, the page writeback flushes the queued folios also by
batches.  Its batching logic is independent from that of the page reclaim.
For each of the folios it writes back, the page writeback calls
folio_rotate_reclaimable() which tries to rotate a folio to the tail.

folio_rotate_reclaimable() only works for a folio after the page reclaim
has put it back.  If an async swap device is fast enough, the page
writeback can finish with that folio while the page reclaim is still
working on the rest of the batch containing it.  In this case, that folio
will remain at the head and the page reclaim will not retry it before
reaching there.

---
v4:
 - conbine patch 1 and patch 2 together in v3.
 - refine commit msg.
 - fix builds errors reported-by: kernel test robot <lkp@intel.com>.
v3:
 - fix this issue in the same with way as multi-gen LRU.

v2:
 - detect folios whose writeback has done and move them to the tail
    of lru. suggested by Barry Song
[2] https://lore.kernel.org/linux-kernel/CAGsJ_4zqL8ZHNRZ44o_CC69kE7DBVXvbZfvmQxMGiFqRxqHQdA@mail.gmail.com/

v1:
[1] https://lore.kernel.org/linux-kernel/20241010081802.290893-1-chenridong@huaweicloud.com/

Chen Ridong (1):
  mm: vmascan: retry folios written back while isolated for traditional
    LRU

 include/linux/mmzone.h |   3 +-
 mm/vmscan.c            | 108 +++++++++++++++++++++++++++++------------
 2 files changed, 77 insertions(+), 34 deletions(-)

-- 
2.34.1



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

end of thread, other threads:[~2024-12-13  0:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-09  8:36 [PATCH v4 0/1] mm: vmascan: retry folios written back while isolated for traditional LRU Chen Ridong
2024-12-09  8:36 ` [PATCH v4 1/1] " Chen Ridong
2024-12-10  4:54   ` Barry Song
2024-12-10  6:41     ` chenridong
2024-12-10  8:24       ` Barry Song
2024-12-10 12:11         ` chenridong
2024-12-12 23:17           ` Barry Song
2024-12-13  0:54             ` chenridong
2024-12-10  2:13 ` [PATCH v4 0/1] " Andrew Morton
2024-12-10  6:42   ` chenridong

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