The patch titled Subject: mm/filemap: don't decrease mmap_miss when folio has workingset flag has been added to the -mm mm-unstable branch. Its filename is mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Liu Shixin <liushixin2@xxxxxxxxxx> Subject: mm/filemap: don't decrease mmap_miss when folio has workingset flag Date: Tue, 26 Mar 2024 14:50:26 +0800 add comments Link: https://lkml.kernel.org/r/20240326065026.1910584-1-liushixin2@xxxxxxxxxx Signed-off-by: Liu Shixin <liushixin2@xxxxxxxxxx> Reviewed-by: Jan Kara <jack@xxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Christian Brauner <brauner@xxxxxxxxxx> Cc: Jinjiang Tu <tujinjiang@xxxxxxxxxx> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/filemap.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/mm/filemap.c~mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags-fix +++ a/mm/filemap.c @@ -3492,6 +3492,13 @@ static vm_fault_t filemap_map_folio_rang if (PageHWPoison(page + count)) goto skip; + /* + * If there are too many folios that are recently evicted + * in a file, they will probably continue to be evicted. + * In such situation, read-ahead is only a waste of IO. + * Don't decrease mmap_miss in this scenario to make sure + * we can stop read-ahead. + */ if (!folio_test_workingset(folio)) (*mmap_miss)++; @@ -3542,6 +3549,7 @@ static vm_fault_t filemap_map_order0_fol if (PageHWPoison(page)) return ret; + /* See comment of filemap_map_folio_range() */ if (!folio_test_workingset(folio)) (*mmap_miss)++; _ Patches currently in -mm which might be from liushixin2@xxxxxxxxxx are mm-readahead-break-read-ahead-loop-if-filemap_add_folio-return-enomem.patch mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags.patch mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags-fix.patch