diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index acfd3bf217e0..5d6af237e0fe 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -351,9 +351,9 @@ DECLARE_HOOK(android_vh_filemap_read, TP_PROTO(struct file *file, loff_t pos, size_t size), TP_ARGS(file, pos, size)); DECLARE_HOOK(android_vh_filemap_map_pages, - TP_PROTO(struct file *file, pgoff_t first_pgoff, + TP_PROTO(struct file *file, pgoff_t orig_start_pgoff, pgoff_t first_pgoff, pgoff_t last_pgoff, vm_fault_t ret), - TP_ARGS(file, first_pgoff, last_pgoff, ret)); + TP_ARGS(file, orig_start_pgoff, first_pgoff, last_pgoff, ret)); DECLARE_HOOK(android_vh_page_cache_readahead_start, TP_PROTO(struct file *file, pgoff_t pgoff, unsigned int size, bool sync), diff --git a/mm/filemap.c b/mm/filemap.c index 963a6d273224..6540cc77a20b 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3700,12 +3700,14 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf, unsigned long rss = 0; unsigned int nr_pages = 0, mmap_miss = 0, mmap_miss_saved, folio_type; pgoff_t first_pgoff = 0; + pgoff_t orig_start_pgoff = start_pgoff; rcu_read_lock(); folio = next_uptodate_folio(&xas, mapping, end_pgoff); if (!folio) goto out; first_pgoff = xas.xa_index; + orig_start_pgoff = xas.xa_index; if (filemap_map_pmd(vmf, folio, start_pgoff)) { ret = VM_FAULT_NOPAGE; @@ -3756,7 +3758,8 @@ out: WRITE_ONCE(file->f_ra.mmap_miss, 0); else WRITE_ONCE(file->f_ra.mmap_miss, mmap_miss_saved - mmap_miss); - trace_android_vh_filemap_map_pages(file, first_pgoff, last_pgoff, ret); + trace_android_vh_filemap_map_pages(file, orig_start_pgoff, + first_pgoff, last_pgoff, ret); return ret; }