kernel slab misc
console:/sys/kernel/slab # ls
:0000008 bio-0 kioctx
:0000016 bio-1 kmalloc-128
:0000024 bio-2 kmalloc-1k
:0000032 bio-3 kmalloc-256
:0000040 biovec-128 kmalloc-2k
:0000048 biovec-16 kmalloc-4k
:0000056 biovec-64 kmalloc-512
:0000064 biovec-max kmalloc-8k
:0000072 blkdev_ioc kmalloc-rcl-128
:0000088 blkdev_requests kmalloc-rcl-1k
:0000096 bridge_fdb_cache kmalloc-rcl-256
:0000104 buffer_head kmalloc-rcl-2k
:0000120 cb_event kmalloc-rcl-4k
:0000128 cifs_inode_cache kmalloc-rcl-512
:0000160 cifs_mpx_ids kmalloc-rcl-8k
:0000192 cifs_request kmem_cache
:0000200 cifs_small_rq kmem_cache_node
在每个slab目录下,有个trace文件,echo 1到这个文件即可trace这个slab的alloc、trace calltrace,calltrace会打印到kernel log,dmesg即可看到这些log:
console:/sys/kernel/slab/mm_struct # ls
aliases destroy_by_rcu objects_partial red_zone store_user
align free_calls objs_per_slab sanity_checks total_objects
alloc_calls hwcache_align order shrink trace
cpu_partial min_partial partial slab_size usersize
cpu_slabs object_size poison slabs validate
ctor objects reclaim_account slabs_cpu_partial
[ 1044.424439] Object 00000000a8af9343: e8 98 7e 09 80 ff ff ff 00 00 00 00 00 00 00 00 ..~.............
[ 1044.424444] Object 00000000437c8525: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 1044.424448] Object 00000000c07bc299: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 1044.424452] Object 00000000068e79d3: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 1044.424457] Object 000000005f099c70: 00 00 00 00 00 00 00 00 ........
[ 1044.424465] CPU: 0 PID: 4866 Comm: sh Tainted: P O 4.19.116+ #4
[ 1044.424469] Hardware name: M7332 (DT)
[ 1044.424472] Call trace:
[ 1044.424484] dump_backtrace+0x0/0x4
[ 1044.424492] dump_stack+0xf4/0x134
[ 1044.424500] free_debug_processing+0x794/0xaf0
[ 1044.424506] kmem_cache_free+0xfb8/0x1520
[ 1044.424513] __mmdrop+0x8c/0x14c
[ 1044.424519] mmput+0x18c/0x1b8
[ 1044.424526] flush_old_exec+0x9d4/0x12c4
[ 1044.424532] load_elf_binary+0x4fc/0x1a84
[ 1044.424537] search_binary_handler+0x164/0x3c0
[ 1044.424543] __do_execve_file+0xa74/0xdc0
[ 1044.424549] __arm64_sys_execve+0x4c/0x5c
[ 1044.424555] el0_svc_common+0xb8/0x1b8
[ 1044.424560] el0_svc_handler+0x74/0x90
[ 1044.424565] el0_svc+0x8/0x340
console:/sys/kernel/slab/mm_struct #