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

Commit 2a0173a

Browse files
zhanghui31Treehugger Robot
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]>
1 parent 0de12a8 commit 2a0173a

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

drivers/android/vendor_hooks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,3 +641,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_modify_src_caps);
641641
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_log);
642642
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_proactive_compact_wmark_high);
643643
EXPORT_TRACEPOINT_SYMBOL_GPL(android_trigger_vendor_lmk_kill);
644+
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_map_pages_range);

include/trace/hooks/mm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ DECLARE_HOOK(android_vh_page_private_mod,
523523
DECLARE_HOOK(android_vh_cma_alloc_fail,
524524
TP_PROTO(char *name, unsigned long count, unsigned long req_count),
525525
TP_ARGS(name, count, req_count));
526+
DECLARE_HOOK(android_vh_filemap_map_pages_range,
527+
TP_PROTO(struct file *file, pgoff_t orig_start_pgoff,
528+
pgoff_t last_pgoff, vm_fault_t ret),
529+
TP_ARGS(file, orig_start_pgoff, last_pgoff, ret));
526530
#endif /* _TRACE_HOOK_MM_H */
527531

528532
/* This part must be outside protection */

mm/filemap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3687,12 +3687,14 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
36873687
vm_fault_t ret = 0;
36883688
unsigned int nr_pages = 0, mmap_miss = 0, mmap_miss_saved;
36893689
pgoff_t first_pgoff = 0;
3690+
pgoff_t orig_start_pgoff = start_pgoff;
36903691

36913692
rcu_read_lock();
36923693
folio = next_uptodate_folio(&xas, mapping, end_pgoff);
36933694
if (!folio)
36943695
goto out;
36953696
first_pgoff = xas.xa_index;
3697+
orig_start_pgoff = xas.xa_index;
36963698

36973699
if (filemap_map_pmd(vmf, folio, start_pgoff)) {
36983700
ret = VM_FAULT_NOPAGE;
@@ -3736,6 +3738,7 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
37363738
else
37373739
WRITE_ONCE(file->f_ra.mmap_miss, mmap_miss_saved - mmap_miss);
37383740
trace_android_vh_filemap_map_pages(file, first_pgoff, last_pgoff, ret);
3741+
trace_android_vh_filemap_map_pages_range(file, orig_start_pgoff, last_pgoff, ret);
37393742

37403743
return ret;
37413744
}

0 commit comments

Comments
 (0)