ANDROID: vendor_hook: Add hook to tune readaround size

In some situations, we want to decrease readaround size for better
performance. So we add this hook.

Bug: 288216516
Bug: 395197442
Change-Id: If2f5f75976c99ff1f82ce29d370f9216926055ab
Signed-off-by: Oven <liyangouwen1@oppo.com>
Signed-off-by: huzhanyuan  <huzhanyuan@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
This commit is contained in:
Oven
2023-06-16 20:51:14 +08:00
committed by Carlos Llamas
parent b6f24657f2
commit 2ad4928594
3 changed files with 7 additions and 0 deletions
+1
View File
@@ -175,6 +175,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_alloc_pages_retry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unreserve_highatomic_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue_bulk_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_mmap_readaround);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_hw_protection_shutdown);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_slab_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_drain_all_pages_bypass);
+4
View File
@@ -226,6 +226,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_vfree_bypass,
DECLARE_HOOK(android_vh_cma_alloc_retry,
TP_PROTO(char *name, int *retry),
TP_ARGS(name, retry));
DECLARE_HOOK(android_vh_tune_mmap_readaround,
TP_PROTO(unsigned int ra_pages, pgoff_t pgoff,
pgoff_t *start, unsigned int *size, unsigned int *async_size),
TP_ARGS(ra_pages, pgoff, start, size, async_size));
DECLARE_HOOK(android_vh_smaps_pte_entry,
TP_PROTO(swp_entry_t entry, int mapcount,
unsigned long *swap_shared, unsigned long *writeback,
+2
View File
@@ -3221,6 +3221,8 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)
ra->start = max_t(long, 0, vmf->pgoff - ra->ra_pages / 2);
ra->size = ra->ra_pages;
ra->async_size = ra->ra_pages / 4;
trace_android_vh_tune_mmap_readaround(ra->ra_pages, vmf->pgoff,
&ra->start, &ra->size, &ra->async_size);
ractl._index = ra->start;
trace_android_vh_page_cache_readahead_start(file, vmf->pgoff,
ra->size, true);