archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <>
To: Andrew Morton <>
Cc: <>, Josef Bacik <>,
	Robert Stupp <>, Minchan Kim <>,
	Jan Kara <>
Subject: [PATCH] mm: Don't bother dropping mmap_sem for zero size readahead
Date: Wed, 12 Feb 2020 11:13:56 +0100	[thread overview]
Message-ID: <> (raw)

When handling a page fault, we drop mmap_sem to start async readahead so
that we don't block on IO submission with mmap_sem held.  However
there's no point to drop mmap_sem in case readahead is disabled. Handle
that case to avoid pointless dropping of mmap_sem and retrying the
fault. This was actually reported to block mlockall(MCL_CURRENT)

Fixes: 6b4c9f446981 ("filemap: drop the mmap_sem for all blocking operations")
Reported-by: Minchan Kim <>
Reported-by: Robert Stupp <>
Signed-off-by: Jan Kara <>
 mm/filemap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Andrew, could you please pick up this patch? Minchan also tripped over this

diff --git a/mm/filemap.c b/mm/filemap.c
index 1146fcfa3215..3d39c437b07e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2458,7 +2458,7 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf,
 	pgoff_t offset = vmf->pgoff;
 	/* If we don't want any read-ahead, don't bother */
-	if (vmf->vma->vm_flags & VM_RAND_READ)
+	if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages)
 		return fpin;
 	if (ra->mmap_miss > 0)

             reply	other threads:[~2020-02-12 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 10:13 Jan Kara [this message]
2020-02-12 14:13 ` Josef Bacik
2020-02-12 16:16 ` Minchan Kim
2020-07-30 11:34 ` SeongJae Park
2020-08-01 10:39   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] mm: Don'\''t bother dropping mmap_sem for zero size readahead' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).