ANDROID: Fix lost track action type in save_track_hash

Transmit the track action type to save_track_hash, otherwise we do not know it is allocation stack or free stack.

Fixes: 8bc6337823c6 ("ANDROID: vendor_hooks: add hooks for slab memory leak debugging")
Bug: 184928480
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I74c50c02cfb4ebbf3e9fecdf125e76946ff4e7d1
(cherry picked from commit 7d216e2512082853f4cf0c220a1b48119203144f)
This commit is contained in:
Liujie Xie
2021-06-24 10:10:14 +08:00
committed by Suren Baghdasaryan
parent bcb5f0547e
commit 9122cbfc55
3 changed files with 7 additions and 0 deletions

View File

@@ -353,6 +353,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_mmc_sd_cmdline_timing);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_mmc_sd_dataline_timing);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cfg80211_set_context);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cfg80211_get_context);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_track_hash);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_id_remove);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_offline);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_online);

View File

@@ -28,6 +28,7 @@
struct oom_control;
struct slabinfo;
struct track;
DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags,
TP_PROTO(gfp_t *flags),
@@ -133,6 +134,9 @@ DECLARE_HOOK(android_vh_alloc_pages_failure_bypass,
TP_PROTO(gfp_t gfp_mask, int order, int alloc_flags,
int migratetype, struct page **page),
TP_ARGS(gfp_mask, order, alloc_flags, migratetype, page));
DECLARE_HOOK(android_vh_save_track_hash,
TP_PROTO(bool alloc, struct track *p),
TP_ARGS(alloc, p));
DECLARE_HOOK(android_vh_rmqueue,
TP_PROTO(struct zone *preferred_zone, struct zone *zone,
unsigned int order, gfp_t gfp_flags,

View File

@@ -40,6 +40,7 @@
#include <linux/debugfs.h>
#include <trace/events/kmem.h>
#include <trace/hooks/mm.h>
#include "internal.h"
@@ -734,6 +735,7 @@ static void set_track(struct kmem_cache *s, void *object,
p->cpu = smp_processor_id();
p->pid = current->pid;
p->when = jiffies;
trace_android_vh_save_track_hash(alloc == TRACK_ALLOC, p);
} else {
memset(p, 0, sizeof(struct track));
}