From: Baolin Wang Date: Fri, 17 Oct 2025 07:53:06 +0000 (+0800) Subject: mm: vmscan: filter out the dirty file folios for node_reclaim() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=55065ee9357659ab2f9a825300aae25db41d93d9;p=users%2Fjedix%2Flinux-maple.git mm: vmscan: filter out the dirty file folios for node_reclaim() Patch series "optimize the logic for handling dirty file folios during reclaim", v2. Since we no longer attempt to write back filesystem folios during reclaim, some logic for handling dirty file folios in the reclaim process also needs to be updated. Please check the details in each patch. This patch (of 2): After commit 6b0dfabb3555 ("fs: Remove aops->writepage"), we no longer attempt to write back filesystem folios in pageout(), and only tmpfs/shmem folios and anonymous swapcache folios can be written back. Therefore, we should also filter out the dirty filesystem folios for node_reclaim() to avoid unnecessary LRU scans. Link: https://lkml.kernel.org/r/cover.1760687075.git.baolin.wang@linux.alibaba.com Link: https://lkml.kernel.org/r/c91f5ecc5152b647904c7503618a01885d913928.1760687075.git.baolin.wang@linux.alibaba.com Signed-off-by: Baolin Wang Cc: David Hildenbrand Cc: Hugh Dickins Cc: Johannes Weiner Cc: Lorenzo Stoakes Cc: Matthew Wilcox (Oracle) Cc: Michal Hocko Cc: Qi Zheng Cc: Shakeel Butt Signed-off-by: Andrew Morton --- diff --git a/mm/vmscan.c b/mm/vmscan.c index aab85ef70c1c..320831e78b92 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7601,9 +7601,11 @@ static unsigned long node_pagecache_reclaimable(struct pglist_data *pgdat) else nr_pagecache_reclaimable = node_unmapped_file_pages(pgdat); - /* If we can't clean pages, remove dirty pages from consideration */ - if (!(node_reclaim_mode & RECLAIM_WRITE)) - delta += node_page_state(pgdat, NR_FILE_DIRTY); + /* + * Since we can't clean folios through reclaim, remove dirty file + * folios from consideration. + */ + delta += node_page_state(pgdat, NR_FILE_DIRTY); /* Watch for any possible underflows due to delta */ if (unlikely(delta > nr_pagecache_reclaimable))