ANDROID: vendor_hooks: mm: add hook to count the number pages
allocated for each slab We want to add an interface that can detect the number of pages allocated by the slab, and if exceeds a threshold, trigger a panic or other actions. Bug: 302090264 Change-Id: I8fcae6a97046806376b95b66085dd5b852c2d1e8 Signed-off-by: Haonan Wang <haonan.wang@unisoc.com>
This commit is contained in:
parent
a59b32866c
commit
6e881bf034
@ -362,3 +362,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_early_resume_begin);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_get_folio);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_blk_mq_rw_recovery);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sd_update_bus_speed_mode);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_slab_folio_alloced);
|
||||
|
@ -196,6 +196,9 @@ DECLARE_HOOK(android_vh_mm_alloc_pages_may_oom_exit,
|
||||
DECLARE_HOOK(android_vh_adjust_kvmalloc_flags,
|
||||
TP_PROTO(unsigned int order, gfp_t *alloc_flags),
|
||||
TP_ARGS(order, alloc_flags));
|
||||
DECLARE_HOOK(android_vh_slab_folio_alloced,
|
||||
TP_PROTO(unsigned int order, gfp_t flags),
|
||||
TP_ARGS(order, flags));
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <trace/events/kmem.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -1823,6 +1824,8 @@ static inline struct slab *alloc_slab_page(gfp_t flags, int node,
|
||||
if (page_is_pfmemalloc(folio_page(folio, 0)))
|
||||
slab_set_pfmemalloc(slab);
|
||||
|
||||
trace_android_vh_slab_folio_alloced(order, flags);
|
||||
|
||||
return slab;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user