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

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

2.Correcting the statistical count error for PGSCAN_DIRECT_THROTTLE.

Bug: 335586788

Change-Id: I85bbf895d678eb3f5269d3e7a7b3b58e0ebd90fe
Signed-off-by: Lei Liu <liulei.rjpt@vivo.corp-partner.google.com>
This commit is contained in:
Lei Liu 2024-09-10 21:49:50 +08:00
parent 1fa94a1407
commit 5596cd79a7
3 changed files with 9 additions and 0 deletions

View File

@ -342,6 +342,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_folio_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_throttle_direct_reclaim_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_perf_huristic_ctrl); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_perf_huristic_ctrl);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_command_post_change); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_command_post_change);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_abort_success_ctrl); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_abort_success_ctrl);

View File

@ -24,6 +24,9 @@ DECLARE_HOOK(android_vh_check_folio_look_around_ref,
DECLARE_HOOK(android_vh_do_shrink_slab, DECLARE_HOOK(android_vh_do_shrink_slab,
TP_PROTO(struct shrinker *shrinker, long *freeable), TP_PROTO(struct shrinker *shrinker, long *freeable),
TP_ARGS(shrinker, freeable)); TP_ARGS(shrinker, freeable));
DECLARE_HOOK(android_vh_throttle_direct_reclaim_bypass,
TP_PROTO(bool *bypass),
TP_ARGS(bypass));
DECLARE_HOOK(android_vh_vmscan_kswapd_done, DECLARE_HOOK(android_vh_vmscan_kswapd_done,
TP_PROTO(int node_id, unsigned int highest_zoneidx, unsigned int alloc_order, TP_PROTO(int node_id, unsigned int highest_zoneidx, unsigned int alloc_order,
unsigned int reclaim_order), unsigned int reclaim_order),

View File

@ -7154,6 +7154,7 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
struct zoneref *z; struct zoneref *z;
struct zone *zone; struct zone *zone;
pg_data_t *pgdat = NULL; pg_data_t *pgdat = NULL;
bool bypass = false;
/* /*
* Kernel threads should not be throttled as they may be indirectly * Kernel threads should not be throttled as they may be indirectly
@ -7202,6 +7203,10 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
if (!pgdat) if (!pgdat)
goto out; goto out;
trace_android_vh_throttle_direct_reclaim_bypass(&bypass);
if (bypass)
goto out;
/* Account for the throttling */ /* Account for the throttling */
count_vm_event(PGSCAN_DIRECT_THROTTLE); count_vm_event(PGSCAN_DIRECT_THROTTLE);