Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 563c4f2

Browse files
zhanghui31Carlos Llamas
authored andcommitted
ANDROID: mm: add a new vendor hook in filemap_map_pages
In the current vendor hook, if next_uptodate_folio returns NULL, the first_pgoff is set to zero, and the last_pgoff is set to start_pgoff. Therefore, the collection range is from 0 to the start_pgoff. |-----------|------------|-------------|------------------| 0 start_pgoff first_pgoff last_pgoff end_pgoff We want to collect the first_pgoff to last_pgoff, so we have to add a new vendor hook. Bug: 397274634 Change-Id: I19d54c601e2ffc5de5ec2dafcd43fbdcdc84b0d2 Signed-off-by: zhanghui <[email protected]> (cherry picked from commit 2a0173a)
1 parent 0c38091 commit 563c4f2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

include/trace/hooks/mm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,9 @@ DECLARE_HOOK(android_vh_filemap_read,
351351
TP_PROTO(struct file *file, loff_t pos, size_t size),
352352
TP_ARGS(file, pos, size));
353353
DECLARE_HOOK(android_vh_filemap_map_pages,
354-
TP_PROTO(struct file *file, pgoff_t first_pgoff,
354+
TP_PROTO(struct file *file, pgoff_t orig_start_pgoff, pgoff_t first_pgoff,
355355
pgoff_t last_pgoff, vm_fault_t ret),
356-
TP_ARGS(file, first_pgoff, last_pgoff, ret));
356+
TP_ARGS(file, orig_start_pgoff, first_pgoff, last_pgoff, ret));
357357
DECLARE_HOOK(android_vh_page_cache_readahead_start,
358358
TP_PROTO(struct file *file, pgoff_t pgoff,
359359
unsigned int size, bool sync),

mm/filemap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3700,12 +3700,14 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
37003700
unsigned long rss = 0;
37013701
unsigned int nr_pages = 0, mmap_miss = 0, mmap_miss_saved, folio_type;
37023702
pgoff_t first_pgoff = 0;
3703+
pgoff_t orig_start_pgoff = start_pgoff;
37033704

37043705
rcu_read_lock();
37053706
folio = next_uptodate_folio(&xas, mapping, end_pgoff);
37063707
if (!folio)
37073708
goto out;
37083709
first_pgoff = xas.xa_index;
3710+
orig_start_pgoff = xas.xa_index;
37093711

37103712
if (filemap_map_pmd(vmf, folio, start_pgoff)) {
37113713
ret = VM_FAULT_NOPAGE;
@@ -3756,7 +3758,8 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
37563758
WRITE_ONCE(file->f_ra.mmap_miss, 0);
37573759
else
37583760
WRITE_ONCE(file->f_ra.mmap_miss, mmap_miss_saved - mmap_miss);
3759-
trace_android_vh_filemap_map_pages(file, first_pgoff, last_pgoff, ret);
3761+
trace_android_vh_filemap_map_pages(file, orig_start_pgoff,
3762+
first_pgoff, last_pgoff, ret);
37603763

37613764
return ret;
37623765
}

0 commit comments

Comments
 (0)