[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200212221614.215302-1-minchan@kernel.org>
Date: Wed, 12 Feb 2020 14:16:12 -0800
From: Minchan Kim <minchan@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>,
Jan Kara <jack@...e.cz>, Matthew Wilcox <willy@...radead.org>,
Josef Bacik <josef@...icpanda.com>,
Johannes Weiner <hannes@...xchg.org>,
Minchan Kim <minchan@...nel.org>, Robert Stupp <snazy@....de>
Subject: [PATCH 1/3] mm: Don't bother dropping mmap_sem for zero size readahead
From: Jan Kara <jack@...e.cz>
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)
indefinitely.
Fixes: 6b4c9f446981 ("filemap: drop the mmap_sem for all blocking operations")
Reported-by: Minchan Kim <minchan@...nel.org>
Reported-by: Robert Stupp <snazy@....de>
Reviewed-by: Minchan Kim <minchan@...nel.org>
Reviewed-by: Josef Bacik <josef@...icpanda.com>
Signed-off-by: Jan Kara <jack@...e.cz>
Signed-off-by: Minchan Kim <minchan@...nel.org>
---
mm/filemap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index 1784478270e1..5bffaa2176cd 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2416,7 +2416,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)
ra->mmap_miss--;
--
2.25.0.225.g125e21ebc7-goog
Powered by blists - more mailing lists