diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 0c324054c782..d018bb824d0f 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -311,6 +311,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_gpio_cd_irqt); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_vmalloc_stack); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_stack_hash); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_track_hash); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vmpressure); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_task_comm); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_acct_update_power); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_log); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index d58e0a59a882..e76e3f2f4a3f 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -97,6 +97,10 @@ DECLARE_HOOK(android_vh_show_stack_hash, DECLARE_HOOK(android_vh_save_track_hash, TP_PROTO(bool alloc, unsigned long p), TP_ARGS(alloc, p)); +struct mem_cgroup; +DECLARE_HOOK(android_vh_vmpressure, + TP_PROTO(struct mem_cgroup *memcg, bool *bypass), + TP_ARGS(memcg, bypass)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/vmpressure.c b/mm/vmpressure.c index d69019fc3789..26d6577d0a55 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -21,6 +21,8 @@ #include #include +#include + /* * The window size (vmpressure_win) is the number of scanned pages before * we try to analyze scanned/reclaimed ratio. So the window is used as a @@ -241,6 +243,11 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree, unsigned long scanned, unsigned long reclaimed) { struct vmpressure *vmpr = memcg_to_vmpressure(memcg); + bool bypass = false; + + trace_android_vh_vmpressure(memcg, &bypass); + if (unlikely(bypass)) + return; /* * Here we only want to account pressure that userland is able to