lkml.org 
[lkml]   [2020]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v5 37/39] mm: Allow PageReadahead to be set on head pages
Date
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Adjust the callers to only call PageReadahead on the head page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 4 ++--
mm/filemap.c | 14 +++++++-------
2 files changed, 9 insertions(+), 9 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..7d38eb9c2229 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2067,9 +2067,9 @@ 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,
+ ra, filp, compound_head(page),
index, last_index - index);
}
if (!PageUptodate(page)) {
@@ -2454,10 +2454,10 @@ 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);
+ compound_head(page), offset, ra->ra_pages);
}
return fpin;
}
@@ -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
\
 
 \ /
  Last update: 2020-05-29 05:01    [W:0.153 / U:0.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site