After insmod kmemleak-test.ko, a leaking for alloc_percpu will be reported as below: kmemleak: alloc_percpu(sizeof(*elem)) = 00007dfdd26a2c40 : : unreferenced object 0x7dfdd26a2c40 (size 8): comm "insmod", pid 183, jiffies 4294905864 (age 40.520s) hex dump (first 8 bytes): 00 00 00 00 00 00 00 00 ........ backtrace: [<(____ptrval____)>] pcpu_alloc+0x3ec/0x8c8 [<(____ptrval____)>] __alloc_percpu+0x18/0x28 [<(____ptrval____)>] 0xffff800008df525c [<(____ptrval____)>] do_one_initcall+0x60/0x1d8 [<(____ptrval____)>] do_init_module+0x58/0x1d0 [<(____ptrval____)>] load_module+0x1d8c/0x23d0 [<(____ptrval____)>] __do_sys_finit_module+0xdc/0xf8 [<(____ptrval____)>] __arm64_sys_finit_module+0x20/0x30 [<(____ptrval____)>] el0_svc_common.constprop.3+0x68/0x170 [<(____ptrval____)>] do_el0_svc+0x24/0x90 [<(____ptrval____)>] el0_sync_handler+0x13c/0x1a8 [<(____ptrval____)>] el0_sync+0x158/0x180 Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx> Signed-off-by: Chen Jun <chenjun102@xxxxxxxxxx> --- mm/kmemleak-test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/kmemleak-test.c b/mm/kmemleak-test.c index 75fe1b8c3226..8f3e4a60166b 100644 --- a/mm/kmemleak-test.c +++ b/mm/kmemleak-test.c @@ -79,6 +79,9 @@ static int __init kmemleak_test_init(void) per_cpu(kmemleak_test_pointer, i)); } + pr_info("alloc_percpu(sizeof(*elem)) = %px\n", + alloc_percpu(sizeof(*elem))); + return 0; } module_init(kmemleak_test_init); -- 2.25.0