ANDROID: mm: add vendor hook to tune warn_alloc

Add vendor hook to tune or add ratelimit at warn_alloc.

Bug: 351175506

Change-Id: Iff75cc98aa29d29f06f924dac5ed6df2c0ffffdb
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
Sooyong Suk
2024-07-11 15:23:27 +09:00
committed by Suren Baghdasaryan
parent e510840c8e
commit 28f7bd7ed4
3 changed files with 13 additions and 0 deletions
+2
View File
@@ -308,3 +308,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_trigger_vendor_lmk_kill);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_contig_range_not_isolated);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_warn_alloc_tune_ratelimit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_warn_alloc_show_mem_bypass);
+6
View File
@@ -200,6 +200,12 @@ DECLARE_HOOK(android_vh_alloc_pages_slowpath_end,
DECLARE_HOOK(android_vh_alloc_contig_range_not_isolated,
TP_PROTO(unsigned long start, unsigned end),
TP_ARGS(start, end));
DECLARE_HOOK(android_vh_warn_alloc_tune_ratelimit,
TP_PROTO(struct ratelimit_state *rs),
TP_ARGS(rs));
DECLARE_HOOK(android_vh_warn_alloc_show_mem_bypass,
TP_PROTO(bool *bypass),
TP_ARGS(bypass));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */
+5
View File
@@ -3657,7 +3657,11 @@ try_this_zone:
static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask)
{
unsigned int filter = SHOW_MEM_FILTER_NODES;
bool bypass = false;
trace_android_vh_warn_alloc_show_mem_bypass(&bypass);
if (bypass)
return;
/*
* This documents exceptions given to allocations in certain
* contexts that are allowed to allocate outside current's set
@@ -3679,6 +3683,7 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...)
va_list args;
static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1);
trace_android_vh_warn_alloc_tune_ratelimit(&nopage_rs);
if ((gfp_mask & __GFP_NOWARN) ||
!__ratelimit(&nopage_rs) ||
((gfp_mask & __GFP_DMA) && !has_managed_dma()))