[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230915183848.1018717-12-kernel@pankajraghav.com>
Date: Fri, 15 Sep 2023 20:38:36 +0200
From: Pankaj Raghav <kernel@...kajraghav.com>
To: linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org
Cc: p.raghav@...sung.com, david@...morbit.com, da.gomez@...sung.com,
akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
willy@...radead.org, djwong@...nel.org, linux-mm@...ck.org,
chandan.babu@...cle.com, mcgrof@...nel.org, gost.dev@...sung.com
Subject: [RFC 11/23] filemap: align the index to mapping_min_order in do_[a]sync_mmap_readahead
From: Pankaj Raghav <p.raghav@...sung.com>
Align the index to the mapping_min_order number of pages in
do_[a]sync_mmap_readahead().
Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
---
mm/filemap.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index 8a4bbddcf575..3853df90f9cf 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3164,7 +3164,10 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)
struct file *file = vmf->vma->vm_file;
struct file_ra_state *ra = &file->f_ra;
struct address_space *mapping = file->f_mapping;
- DEFINE_READAHEAD(ractl, file, ra, mapping, vmf->pgoff);
+ int order = mapping_min_folio_order(mapping);
+ unsigned int nrpages = 1U << order;
+ pgoff_t index = round_down(vmf->pgoff, nrpages);
+ DEFINE_READAHEAD(ractl, file, ra, mapping, index);
struct file *fpin = NULL;
unsigned long vm_flags = vmf->vma->vm_flags;
unsigned int mmap_miss;
@@ -3216,10 +3219,11 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)
*/
fpin = maybe_unlock_mmap_for_io(vmf, fpin);
ra->start = max_t(long, 0, vmf->pgoff - ra->ra_pages / 2);
+ ra->start = round_down(ra->start, nrpages);
ra->size = ra->ra_pages;
ra->async_size = ra->ra_pages / 4;
ractl._index = ra->start;
- page_cache_ra_order(&ractl, ra, 0);
+ page_cache_ra_order(&ractl, ra, order);
return fpin;
}
@@ -3233,7 +3237,10 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf,
{
struct file *file = vmf->vma->vm_file;
struct file_ra_state *ra = &file->f_ra;
- DEFINE_READAHEAD(ractl, file, ra, file->f_mapping, vmf->pgoff);
+ int order = mapping_min_folio_order(file->f_mapping);
+ unsigned int nrpages = 1U << order;
+ pgoff_t index = round_down(vmf->pgoff, nrpages);
+ DEFINE_READAHEAD(ractl, file, ra, file->f_mapping, index);
struct file *fpin = NULL;
unsigned int mmap_miss;
--
2.40.1
Powered by blists - more mailing lists