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:
Liujie Xie
2021-08-25 02:26:18 +08:00
committed by Suren Baghdasaryan
parent 73839b71c8
commit 94fbab9d6c
2 changed files with 8 additions and 0 deletions

View File

@@ -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];
}