ANDROID: vendor hooks: skip mem reclaim throttle to speed up mem alloc

Allowing certain important threads to skip waiting and direct mem
reclaim, speeding up mem allocation for critical processes.

Bug: 411514531

Change-Id: I56506249bb5eda705185476c71eb4b9c7e3a3a55
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.corp-partner.google.com>
This commit is contained in:
Qianfeng Rong
2025-04-18 11:09:06 +08:00
committed by Treehugger Robot
parent 9b379efd25
commit 95e6a11201
3 changed files with 9 additions and 0 deletions
+1
View File
@@ -478,6 +478,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_direct_reclaim_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_read_fault);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_pages_reclaim_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_pages_reclaim_cycle_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_throttle_direct_reclaim_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_bd_link_disk_holder);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_del_ref);
+3
View File
@@ -98,6 +98,9 @@ DECLARE_HOOK(android_vh_direct_reclaim_begin,
DECLARE_HOOK(android_vh_direct_reclaim_end,
TP_PROTO(int prio),
TP_ARGS(prio));
DECLARE_HOOK(android_vh_throttle_direct_reclaim_bypass,
TP_PROTO(bool *bypass),
TP_ARGS(bypass));
#endif /* _TRACE_HOOK_VMSCAN_H */
/* This part must be outside protection */
+5
View File
@@ -6574,6 +6574,7 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
struct zoneref *z;
struct zone *zone;
pg_data_t *pgdat = NULL;
bool bypass = false;
/*
* Kernel threads should not be throttled as they may be indirectly
@@ -6622,6 +6623,10 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
if (!pgdat)
goto out;
trace_android_vh_throttle_direct_reclaim_bypass(&bypass);
if (bypass)
goto out;
/* Account for the throttling */
count_vm_event(PGSCAN_DIRECT_THROTTLE);