diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9d1886200973..67558027af6e 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -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); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index acf4973a383e..4afb53f72db3 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -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 */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 26efdf5bad0f..dd1154f6c950 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -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()))