* [PATCH] mm: skip dirty file folios during isolation
@ 2026-03-18 9:06 zhaoyang.huang
2026-03-18 13:50 ` Johannes Weiner
0 siblings, 1 reply; 3+ messages in thread
From: zhaoyang.huang @ 2026-03-18 9:06 UTC (permalink / raw)
To: Andrew Morton, Axel Rasmussen, Yuanchu Xie, Wei Xu,
Johannes Weiner, David Hildenbrand, Michal Hocko, Qi Zheng,
Matthew Wilcox, linux-mm, linux-kernel, Zhaoyang Huang,
steve.kang
From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
Since dirty file folios are no longer writeout in reclaiming after
'commit 84798514db50 ("mm: Remove swap_writepage() and
shmem_writepage()")', there is no need to isolate them from LRU which
could help to improve the scan efficiency.
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
mm/vmscan.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 10f1e7d716ca..3a029dede5ce 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4507,6 +4507,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c
static bool isolate_folio(struct lruvec *lruvec, struct folio *folio, struct scan_control *sc)
{
bool success;
+ struct address_space *mapping = folio_mapping(folio);
/* swap constrained */
if (!(sc->gfp_mask & __GFP_IO) &&
@@ -4514,6 +4515,11 @@ static bool isolate_folio(struct lruvec *lruvec, struct folio *folio, struct sca
(folio_test_anon(folio) && !folio_test_swapcache(folio))))
return false;
+ /* skip dirty file pages since they can't be writeout */
+ if (mapping && !shmem_mapping(mapping) &&
+ !folio_test_anon(folio) && folio_test_dirty(folio))
+ return false;
+
/* raced with release_pages() */
if (!folio_try_get(folio))
return false;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] mm: skip dirty file folios during isolation
2026-03-18 9:06 [PATCH] mm: skip dirty file folios during isolation zhaoyang.huang
@ 2026-03-18 13:50 ` Johannes Weiner
2026-03-19 0:46 ` Zhaoyang Huang
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Weiner @ 2026-03-18 13:50 UTC (permalink / raw)
To: zhaoyang.huang
Cc: Andrew Morton, Axel Rasmussen, Yuanchu Xie, Wei Xu,
David Hildenbrand, Michal Hocko, Qi Zheng, Matthew Wilcox,
linux-mm, linux-kernel, Zhaoyang Huang, steve.kang
On Wed, Mar 18, 2026 at 05:06:56PM +0800, zhaoyang.huang wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
>
> Since dirty file folios are no longer writeout in reclaiming after
> 'commit 84798514db50 ("mm: Remove swap_writepage() and
> shmem_writepage()")', there is no need to isolate them from LRU which
> could help to improve the scan efficiency.
The reclaim scanner needs to sample dirty state to coordinate if early
writeback is necessary:
try_to_shrink_lruvec():
/*
* If too many file cache in the coldest generation can't be evicted
* due to being dirty, wake up the flusher.
*/
if (sc->nr.unqueued_dirty && sc->nr.unqueued_dirty == sc->nr.file_taken)
wakeup_flusher_threads(WB_REASON_VMSCAN);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] mm: skip dirty file folios during isolation
2026-03-18 13:50 ` Johannes Weiner
@ 2026-03-19 0:46 ` Zhaoyang Huang
0 siblings, 0 replies; 3+ messages in thread
From: Zhaoyang Huang @ 2026-03-19 0:46 UTC (permalink / raw)
To: Johannes Weiner
Cc: zhaoyang.huang, Andrew Morton, Axel Rasmussen, Yuanchu Xie,
Wei Xu, David Hildenbrand, Michal Hocko, Qi Zheng, Matthew Wilcox,
linux-mm, linux-kernel, steve.kang
On Wed, Mar 18, 2026 at 9:50 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> On Wed, Mar 18, 2026 at 05:06:56PM +0800, zhaoyang.huang wrote:
> > From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> >
> > Since dirty file folios are no longer writeout in reclaiming after
> > 'commit 84798514db50 ("mm: Remove swap_writepage() and
> > shmem_writepage()")', there is no need to isolate them from LRU which
> > could help to improve the scan efficiency.
>
> The reclaim scanner needs to sample dirty state to coordinate if early
> writeback is necessary:
>
> try_to_shrink_lruvec():
> /*
> * If too many file cache in the coldest generation can't be evicted
> * due to being dirty, wake up the flusher.
> */
> if (sc->nr.unqueued_dirty && sc->nr.unqueued_dirty == sc->nr.file_taken)
> wakeup_flusher_threads(WB_REASON_VMSCAN);
Thanks for heads up. Just find out that dirty file pages have been
promoted to younger gen under MGLRU, will update the code in patchv2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-19 0:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 9:06 [PATCH] mm: skip dirty file folios during isolation zhaoyang.huang
2026-03-18 13:50 ` Johannes Weiner
2026-03-19 0:46 ` Zhaoyang Huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox