ANDROID: vendor_hooks: add hooks for adjust kvmalloc_node alloc_flags

since we can't control all kvmalloc_node callsite's gfp_flags, we add
a vendor hook in kvmalloc_node to tune the reclaim behavior for some
really high-order allocation

Bug: 300857012
Bug: 395197442
Change-Id: I5f0c4c2921d204289911704e3a205f6a1dc50d04
Signed-off-by: liwei <liwei1234@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
This commit is contained in:
liwei
2023-10-25 09:45:04 +08:00
committed by Carlos Llamas
parent 537089e284
commit c837e3a95d
3 changed files with 6 additions and 0 deletions
+1
View File
@@ -369,6 +369,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_warn_alloc_show_mem_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_vm_swappiness);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_control);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_track_hash);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_adjust_kvmalloc_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_process_madvise_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_pageout_return_error);
+3
View File
@@ -346,6 +346,9 @@ DECLARE_HOOK(android_vh_show_stack_hash,
DECLARE_HOOK(android_vh_save_track_hash,
TP_PROTO(bool alloc, struct track *p),
TP_ARGS(alloc, p));
DECLARE_HOOK(android_vh_adjust_kvmalloc_flags,
TP_PROTO(unsigned int order, gfp_t *alloc_flags),
TP_ARGS(order, alloc_flags));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */
+2
View File
@@ -633,6 +633,8 @@ static gfp_t kmalloc_gfp_adjust(gfp_t flags, size_t size)
flags &= ~__GFP_NOFAIL;
}
trace_android_vh_adjust_kvmalloc_flags(get_order(size), &flags);
return flags;
}