All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* + mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags.patch added to mm-unstable branch
@ 2024-03-22 18:56 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-03-22 18:56 UTC (permalink / raw
  To: mm-commits, willy, viro, tujinjiang, jack, brauner, liushixin2,
	akpm


The patch titled
     Subject: mm/readahead: don't decrease mmap_miss when folio has workingset flags
has been added to the -mm mm-unstable branch.  Its filename is
     mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags.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.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@huawei.com>
Subject: mm/readahead: don't decrease mmap_miss when folio has workingset flags
Date: Fri, 22 Mar 2024 17:35:55 +0800

If there are too many folios that are recently evicted in a file, then
they will probably continue to be evicted.  In such situation, there is no
positive effect to read-ahead this file since it is only a waste of IO.

The mmap_miss is increased in do_sync_mmap_readahead() and decreased in
both do_async_mmap_readahead() and filemap_map_pages().  In order to skip
read-ahead in above scenario, the mmap_miss have to increased exceed
MMAP_LOTSAMISS.  This can be done by stop decreased mmap_miss when folio
has workingset flags.  The async path is not to care because in above
scenario, it's hard to run into the async path.

Link: https://lkml.kernel.org/r/20240322093555.226789-3-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Jinjiang Tu <tujinjiang@huawei.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/filemap.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/mm/filemap.c~mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags
+++ a/mm/filemap.c
@@ -3492,7 +3492,8 @@ static vm_fault_t filemap_map_folio_rang
 		if (PageHWPoison(page + count))
 			goto skip;
 
-		(*mmap_miss)++;
+		if (!folio_test_workingset(folio))
+			(*mmap_miss)++;
 
 		/*
 		 * NOTE: If there're PTE markers, we'll leave them to be
@@ -3541,7 +3542,8 @@ static vm_fault_t filemap_map_order0_fol
 	if (PageHWPoison(page))
 		return ret;
 
-	(*mmap_miss)++;
+	if (!folio_test_workingset(folio))
+		(*mmap_miss)++;
 
 	/*
 	 * NOTE: If there're PTE markers, we'll leave them to be
_

Patches currently in -mm which might be from liushixin2@huawei.com 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-22 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-22 18:56 + mm-readahead-dont-decrease-mmap_miss-when-folio-has-workingset-flags.patch added to mm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.