* [PATCH] mm: vmscan: remove the redundant FOLIOREF_RECLAIM_CLEAN logic
@ 2026-06-29 8:04 Baolin Wang
2026-06-29 12:43 ` Johannes Weiner
2026-06-29 15:43 ` Shakeel Butt
0 siblings, 2 replies; 3+ messages in thread
From: Baolin Wang @ 2026-06-29 8:04 UTC (permalink / raw)
To: akpm, hannes
Cc: kasong, qi.zheng, shakeel.butt, baohua, axelrasmussen, yuanchu,
weixugc, david, mhocko, ljs, baolin.wang, linux-mm, linux-kernel
folio_check_references() will return FOLIOREF_RECLAIM_CLEAN for referenced
file folios, indicating that we can proceed to reclaim clean file folios
or keep them if they are dirty file folios. However, after commit 6b0dfabb3555
("fs: Remove aops->writepage"), we no longer attempt to write back filesystem
folios through reclaim. Instead, we always activate dirty file folios and wakeup
the flush workers to write them back. As a result, the FOLIOREF_RECLAIM_CLEAN
logic is now redundant: for dirty file folios, we will no longer reach the
'references == FOLIOREF_RECLAIM_CLEAN' branch in shrink_folio_list().
Additionally, lazyfree folios are also placed on the file LRU list, but if a
lazyfree folio becomes dirty, try_to_unmap() will fail and thus prevent reclaim
of the re-dirtied lazyfree folios.
Therefore, we can drop the FOLIOREF_RECLAIM_CLEAN-related logic.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/vmscan.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 299b5d9e8836..2f7e5878faa5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -823,7 +823,6 @@ void folio_putback_lru(struct folio *folio)
enum folio_references {
FOLIOREF_RECLAIM,
- FOLIOREF_RECLAIM_CLEAN,
FOLIOREF_KEEP,
FOLIOREF_ACTIVATE,
};
@@ -920,10 +919,6 @@ static enum folio_references folio_check_references(struct folio *folio,
return FOLIOREF_KEEP;
}
- /* Reclaim if clean, defer dirty folios to writeback */
- if (referenced_folio && folio_is_file_lru(folio))
- return FOLIOREF_RECLAIM_CLEAN;
-
return FOLIOREF_RECLAIM;
}
@@ -1235,7 +1230,6 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
stat->nr_ref_keep += nr_pages;
goto keep_locked;
case FOLIOREF_RECLAIM:
- case FOLIOREF_RECLAIM_CLEAN:
; /* try to reclaim the folio below */
}
@@ -1381,8 +1375,6 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
goto activate_locked;
}
- if (references == FOLIOREF_RECLAIM_CLEAN)
- goto keep_locked;
if (!may_enter_fs(folio, sc->gfp_mask))
goto keep_locked;
if (!sc->may_writepage)
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: vmscan: remove the redundant FOLIOREF_RECLAIM_CLEAN logic
2026-06-29 8:04 [PATCH] mm: vmscan: remove the redundant FOLIOREF_RECLAIM_CLEAN logic Baolin Wang
@ 2026-06-29 12:43 ` Johannes Weiner
2026-06-29 15:43 ` Shakeel Butt
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Weiner @ 2026-06-29 12:43 UTC (permalink / raw)
To: Baolin Wang
Cc: akpm, kasong, qi.zheng, shakeel.butt, baohua, axelrasmussen,
yuanchu, weixugc, david, mhocko, ljs, linux-mm, linux-kernel
On Mon, Jun 29, 2026 at 04:04:06PM +0800, Baolin Wang wrote:
> folio_check_references() will return FOLIOREF_RECLAIM_CLEAN for referenced
> file folios, indicating that we can proceed to reclaim clean file folios
> or keep them if they are dirty file folios. However, after commit 6b0dfabb3555
> ("fs: Remove aops->writepage"), we no longer attempt to write back filesystem
> folios through reclaim. Instead, we always activate dirty file folios and wakeup
> the flush workers to write them back. As a result, the FOLIOREF_RECLAIM_CLEAN
> logic is now redundant: for dirty file folios, we will no longer reach the
> 'references == FOLIOREF_RECLAIM_CLEAN' branch in shrink_folio_list().
>
> Additionally, lazyfree folios are also placed on the file LRU list, but if a
> lazyfree folio becomes dirty, try_to_unmap() will fail and thus prevent reclaim
> of the re-dirtied lazyfree folios.
>
> Therefore, we can drop the FOLIOREF_RECLAIM_CLEAN-related logic.
>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Good catch and nice cleanup :)
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: vmscan: remove the redundant FOLIOREF_RECLAIM_CLEAN logic
2026-06-29 8:04 [PATCH] mm: vmscan: remove the redundant FOLIOREF_RECLAIM_CLEAN logic Baolin Wang
2026-06-29 12:43 ` Johannes Weiner
@ 2026-06-29 15:43 ` Shakeel Butt
1 sibling, 0 replies; 3+ messages in thread
From: Shakeel Butt @ 2026-06-29 15:43 UTC (permalink / raw)
To: Baolin Wang
Cc: akpm, hannes, kasong, qi.zheng, baohua, axelrasmussen, yuanchu,
weixugc, david, mhocko, ljs, linux-mm, linux-kernel
On Mon, Jun 29, 2026 at 04:04:06PM +0800, Baolin Wang wrote:
> folio_check_references() will return FOLIOREF_RECLAIM_CLEAN for referenced
> file folios, indicating that we can proceed to reclaim clean file folios
> or keep them if they are dirty file folios. However, after commit 6b0dfabb3555
> ("fs: Remove aops->writepage"), we no longer attempt to write back filesystem
> folios through reclaim. Instead, we always activate dirty file folios and wakeup
> the flush workers to write them back. As a result, the FOLIOREF_RECLAIM_CLEAN
> logic is now redundant: for dirty file folios, we will no longer reach the
> 'references == FOLIOREF_RECLAIM_CLEAN' branch in shrink_folio_list().
>
> Additionally, lazyfree folios are also placed on the file LRU list, but if a
> lazyfree folio becomes dirty, try_to_unmap() will fail and thus prevent reclaim
> of the re-dirtied lazyfree folios.
>
> Therefore, we can drop the FOLIOREF_RECLAIM_CLEAN-related logic.
>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-29 15:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 8:04 [PATCH] mm: vmscan: remove the redundant FOLIOREF_RECLAIM_CLEAN logic Baolin Wang
2026-06-29 12:43 ` Johannes Weiner
2026-06-29 15:43 ` Shakeel Butt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox