ANDROID: mm: add vendor hook for vmpressure

Add vendor hook for bypass vmpressure accounting when doing oem's
custom memory reclaim.

Bug: 191534577

Change-Id: I0c2263e03943596312aa6b01cf8506f2ae87213e
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
This commit is contained in:
Liangliang Li 2021-06-21 20:32:49 +08:00 committed by Suren Baghdasaryan
parent c799c6644b
commit 444a0b7752
3 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -21,6 +21,8 @@
#include <linux/printk.h>
#include <linux/vmpressure.h>
#include <trace/hooks/mm.h>
/*
* 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