ANDROID: vendor hooks: Add new android_rvh for adjust water mark

The trace_android_vh_alloc_pages_adjust_wmark() and
trace_android_vh_alloc_pages_reset_wmark() have been deprecated,
because they cannot be used in a CPU offline or non-atomic context,
the trace_android_rvh_alloc_pages_adjust_wmark() and
trace_android_rvh_alloc_pages_reset_wmark() should be used instead.

Bug: 427378244

Change-Id: I641a4bb5548120686a67a56067648b4e23b2f0e1
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.corp-partner.google.com>
This commit is contained in:
Qianfeng Rong
2025-06-25 20:10:29 +08:00
committed by Treehugger Robot
parent 56cc224601
commit 390d8897c3
3 changed files with 26 additions and 1 deletions

View File

@@ -463,6 +463,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_reclaim_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_failure_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_failure_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_adjust_wmark); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_adjust_wmark);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_reset_wmark); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_reset_wmark);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_pages_adjust_wmark);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_pages_reset_wmark);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watermark_fast_ok); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watermark_fast_ok);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_fiq_dump); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_fiq_dump);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapmem_gather_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapmem_gather_init);

View File

@@ -156,6 +156,15 @@ DECLARE_HOOK(android_vh_alloc_pages_reset_wmark,
unsigned long direct_reclaim_retries), unsigned long direct_reclaim_retries),
TP_ARGS(gfp_mask, order, alloc_flags, did_some_progress, TP_ARGS(gfp_mask, order, alloc_flags, did_some_progress,
no_progress_loops, direct_reclaim_retries)); no_progress_loops, direct_reclaim_retries));
DECLARE_RESTRICTED_HOOK(android_rvh_alloc_pages_adjust_wmark,
TP_PROTO(gfp_t gfp_mask, int order, int *alloc_flags),
TP_ARGS(gfp_mask, order, alloc_flags), 3);
DECLARE_RESTRICTED_HOOK(android_rvh_alloc_pages_reset_wmark,
TP_PROTO(gfp_t gfp_mask, int order, int *alloc_flags,
unsigned long *did_some_progress, int *no_progress_loops,
unsigned long direct_reclaim_retries),
TP_ARGS(gfp_mask, order, alloc_flags, did_some_progress,
no_progress_loops, direct_reclaim_retries), 6);
DECLARE_HOOK(android_vh_unreserve_highatomic_bypass, DECLARE_HOOK(android_vh_unreserve_highatomic_bypass,
TP_PROTO(bool force, struct zone *zone, bool *skip_unreserve_highatomic), TP_PROTO(bool force, struct zone *zone, bool *skip_unreserve_highatomic),
TP_ARGS(force, zone, skip_unreserve_highatomic)); TP_ARGS(force, zone, skip_unreserve_highatomic));

View File

@@ -4438,8 +4438,15 @@ restart:
if (alloc_flags & ALLOC_KSWAPD) if (alloc_flags & ALLOC_KSWAPD)
wake_all_kswapds(order, gfp_mask, ac); wake_all_kswapds(order, gfp_mask, ac);
if (can_direct_reclaim && !direct_reclaim_retries && !(current->flags & PF_MEMALLOC)) if (can_direct_reclaim && !direct_reclaim_retries && !(current->flags & PF_MEMALLOC)) {
/*
* The trace_android_vh_alloc_pages_adjust_wmark() has been deprecated
* because it cannot be used in a CPU offline or non-atomic context,
* please use trace_android_rvh_alloc_pages_adjust_wmark().
*/
trace_android_vh_alloc_pages_adjust_wmark(gfp_mask, order, &alloc_flags); trace_android_vh_alloc_pages_adjust_wmark(gfp_mask, order, &alloc_flags);
trace_android_rvh_alloc_pages_adjust_wmark(gfp_mask, order, &alloc_flags);
}
/* /*
* The adjusted alloc_flags might result in immediate success, so try * The adjusted alloc_flags might result in immediate success, so try
@@ -4587,8 +4594,15 @@ retry:
!(gfp_mask & __GFP_RETRY_MAYFAIL))) !(gfp_mask & __GFP_RETRY_MAYFAIL)))
goto nopage; goto nopage;
/*
* The trace_android_vh_alloc_pages_reset_wmark() has been deprecated
* because it cannot be used in a CPU offline or non-atomic context,
* please use trace_android_rvh_alloc_pages_reset_wmark().
*/
trace_android_vh_alloc_pages_reset_wmark(gfp_mask, order, trace_android_vh_alloc_pages_reset_wmark(gfp_mask, order,
&alloc_flags, &did_some_progress, &no_progress_loops, direct_reclaim_retries); &alloc_flags, &did_some_progress, &no_progress_loops, direct_reclaim_retries);
trace_android_rvh_alloc_pages_reset_wmark(gfp_mask, order,
&alloc_flags, &did_some_progress, &no_progress_loops, direct_reclaim_retries);
if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags,
did_some_progress > 0, &no_progress_loops)) did_some_progress > 0, &no_progress_loops))