ANDROID: vendor_hooks: Add hook in kmalloc_slab()
Add hook in kmalloc_slab() for debug kmalloc slab memory leak. Bug: 197614797 Signed-off-by: Liujie Xie <xieliujie@oppo.com> Change-Id: I402a9f968f2bf1e75daa461c05a53a8fabf70028
This commit is contained in:

committed by
Suren Baghdasaryan

parent
73839b71c8
commit
94fbab9d6c
@@ -117,6 +117,9 @@ DECLARE_HOOK(android_vh_mem_cgroup_css_online,
|
||||
DECLARE_HOOK(android_vh_mem_cgroup_css_offline,
|
||||
TP_PROTO(struct cgroup_subsys_state *css, struct mem_cgroup *memcg),
|
||||
TP_ARGS(css, memcg));
|
||||
DECLARE_HOOK(android_vh_kmalloc_slab,
|
||||
TP_PROTO(unsigned int index, gfp_t flags, struct kmem_cache **s),
|
||||
TP_ARGS(index, flags, s));
|
||||
/* macro versions of hooks are no longer required */
|
||||
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
@@ -641,6 +641,7 @@ static inline unsigned int size_index_elem(unsigned int bytes)
|
||||
struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
|
||||
{
|
||||
unsigned int index;
|
||||
struct kmem_cache *s = NULL;
|
||||
|
||||
if (size <= 192) {
|
||||
if (!size)
|
||||
@@ -653,6 +654,10 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
|
||||
index = fls(size - 1);
|
||||
}
|
||||
|
||||
trace_android_vh_kmalloc_slab(index, flags, &s);
|
||||
if (s)
|
||||
return s;
|
||||
|
||||
return kmalloc_caches[kmalloc_type(flags)][index];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user