ANDROID: add vendor hook in do_read_fault to tune fault_around_bytes

with this vendor_hook, oem can dynamically adjust fault_around_bytes to
balance memory usage and performance

Bug: 340744332
Change-Id: I24414c7ba7e77ae06ce5e8cf52377c3485185cfe
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
This commit is contained in:
Dezhi Huang 2024-05-15 14:31:41 +08:00 committed by Treehugger Robot
parent 7fc588d60f
commit 33c78af45a
3 changed files with 6 additions and 0 deletions

View File

@ -368,6 +368,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_dirty_limits);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_oom_check_panic);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks_dn);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_fault_around_bytes);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_blk_reset);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_blk_mq_rw_recovery);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sd_update_bus_speed_mode);

View File

@ -367,6 +367,9 @@ DECLARE_HOOK(android_vh_do_swap_page_spf,
TP_ARGS(allow_swap_spf));
/* macro versions of hooks are no longer required */
DECLARE_HOOK(android_vh_tune_fault_around_bytes,
TP_PROTO(unsigned long *fault_around_bytes),
TP_ARGS(fault_around_bytes));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */

View File

@ -4379,6 +4379,8 @@ static vm_fault_t do_read_fault(struct vm_fault *vmf)
struct vm_area_struct *vma = vmf->vma;
vm_fault_t ret = 0;
trace_android_vh_tune_fault_around_bytes(&fault_around_bytes);
/*
* Let's call ->map_pages() first and use ->fault() as fallback
* if page by the offset is not ready to be mapped (cold cache or