Skip to content
Snippets Groups Projects
Commit 2a0173a4 authored by zhanghui's avatar zhanghui Committed by Treehugger Robot
Browse files

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: default avatarzhanghui <zhanghui31@xiaomi.com>
parent 0de12a81
No related branches found
No related tags found
No related merge requests found
......@@ -641,3 +641,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_modify_src_caps);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_log);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_proactive_compact_wmark_high);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_trigger_vendor_lmk_kill);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_map_pages_range);
......@@ -523,6 +523,10 @@ DECLARE_HOOK(android_vh_page_private_mod,
DECLARE_HOOK(android_vh_cma_alloc_fail,
TP_PROTO(char *name, unsigned long count, unsigned long req_count),
TP_ARGS(name, count, req_count));
DECLARE_HOOK(android_vh_filemap_map_pages_range,
TP_PROTO(struct file *file, pgoff_t orig_start_pgoff,
pgoff_t last_pgoff, vm_fault_t ret),
TP_ARGS(file, orig_start_pgoff, last_pgoff, ret));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */
......
......@@ -3687,12 +3687,14 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
vm_fault_t ret = 0;
unsigned int nr_pages = 0, mmap_miss = 0, mmap_miss_saved;
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;
......@@ -3736,6 +3738,7 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
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_range(file, orig_start_pgoff, last_pgoff, ret);
return ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment