[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200515131656.12890-35-willy@infradead.org>
Date: Fri, 15 May 2020 06:16:54 -0700
From: Matthew Wilcox <willy@...radead.org>
To: linux-fsdevel@...r.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: [PATCH v4 34/36] mm: Allow PageReadahead to be set on head pages
From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
Adjust the callers to only call PageReadahead on the head page.
Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
---
include/linux/page-flags.h | 4 ++--
mm/filemap.c | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 979460df4768..a3110d675cd0 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -377,8 +377,8 @@ PAGEFLAG(MappedToDisk, mappedtodisk, PF_NO_TAIL)
/* PG_readahead is only used for reads; PG_reclaim is only for writes */
PAGEFLAG(Reclaim, reclaim, PF_NO_TAIL)
TESTCLEARFLAG(Reclaim, reclaim, PF_NO_TAIL)
-PAGEFLAG(Readahead, reclaim, PF_NO_COMPOUND)
- TESTCLEARFLAG(Readahead, reclaim, PF_NO_COMPOUND)
+PAGEFLAG(Readahead, reclaim, PF_ONLY_HEAD)
+ TESTCLEARFLAG(Readahead, reclaim, PF_ONLY_HEAD)
#ifdef CONFIG_HIGHMEM
/*
diff --git a/mm/filemap.c b/mm/filemap.c
index 56eb086acef8..f3f03705c025 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2067,7 +2067,7 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb,
if (unlikely(page == NULL))
goto no_cached_page;
}
- if (PageReadahead(page)) {
+ if (PageReadahead(compound_head(page))) {
page_cache_async_readahead(mapping,
ra, filp, page,
index, last_index - index);
@@ -2454,7 +2454,7 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf,
return fpin;
if (ra->mmap_miss > 0)
ra->mmap_miss--;
- if (PageReadahead(page)) {
+ if (PageReadahead(compound_head(page))) {
fpin = maybe_unlock_mmap_for_io(vmf, fpin);
page_cache_async_readahead(mapping, ra, file,
page, offset, ra->ra_pages);
@@ -2640,11 +2640,11 @@ void filemap_map_pages(struct vm_fault *vmf,
/* Has the page moved or been split? */
if (unlikely(page != xas_reload(&xas)))
goto skip;
+ if (PageReadahead(page))
+ goto skip;
page = find_subpage(page, xas.xa_index);
- if (!PageUptodate(page) ||
- PageReadahead(page) ||
- PageHWPoison(page))
+ if (!PageUptodate(page) || PageHWPoison(page))
goto skip;
if (!trylock_page(page))
goto skip;
--
2.26.2
Powered by blists - more mailing lists