ANDROID: android: Add symbols to debug_symbols driver

It's useful to export slab_caches/slab_mutex to detect
slab leak online. Slab may leak on the commercial
version where SLUB_DEBUG is not effective because
SLUB_DEBUG depends on debugfs to show callstacks.

Bug: 350878643

Change-Id: I4e2860992489d881cdde171977008aa6ec9da5cf
Signed-off-by: Penghao Wei <weipenghao@xiaomi.com>
This commit is contained in:
Penghao 2024-07-03 09:54:07 +08:00 committed by Todd Kjos
parent 674cbcb7a2
commit c7b8a41d0f
2 changed files with 5 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include <linux/swap.h>
#include <linux/compaction.h>
#include <linux/cma.h>
#include "../mm/slab.h"
struct ads_entry {
char *name;
@ -50,6 +51,8 @@ static const struct ads_entry ads_entries[ADS_END] = {
ADS_ENTRY(ADS_COMPACT_PAGES, try_to_compact_pages),
ADS_ENTRY(ADS_SHOW_MEM, __show_mem),
ADS_ENTRY(ADS_TOTAL_CMA, &totalcma_pages),
ADS_ENTRY(ADS_SLAB_CACHES, &slab_caches),
ADS_ENTRY(ADS_SLAB_MUTEX, &slab_mutex),
};
/*

View File

@ -20,6 +20,8 @@ enum android_debug_symbol {
ADS_COMPACT_PAGES,
ADS_SHOW_MEM, /* for debugging memory usage */
ADS_TOTAL_CMA, /* for debugging total cma pages */
ADS_SLAB_CACHES, /* for debugging slab */
ADS_SLAB_MUTEX, /* for debugging slab */
ADS_END
};