slub debug enable 하려면 부트 커멘드 라인 추가 요망
 
set bootopts slub_debug=FZPUAO,kmalloc-128
 
https://www.kernel.org/doc/html/v5.4/vm/slub.html>
...
F.e. in order to boot just with sanity checks and red zoning one would specify:
 
slub_debug=FZ
Trying to find an issue in the dentry cache? Try:
 
slub_debug=,dentry
to only enable debugging on the dentry cache. You may use an asterisk at the end of the slab name, in order to cover all slabs with the same prefix. For example, here’s how you can poison the dentry cache as well as all kmalloc slabs:
 
slub_debug=P,kmalloc-*,dentry
Red zoning and tracking may realign the slab. We can just apply sanity checks to the dentry cache with:
 
slub_debug=F,dentry
static int __init setup_slub_debug(char *str)
{
slab_flags_t flags;
char *saved_str;
char *slab_list;
bool global_slub_debug_changed = false;
bool slab_list_specified = false;
 
slub_debug = DEBUG_DEFAULT_FLAGS;
if (*str++ != '=' || !*str)
/*
 * No options specified. Switch on full debugging.
 */
goto out;
 
saved_str = str; // 커멘드 라인 저장
while (str) {
str = parse_slub_debug_flags(str, &flags, &slab_list, true);
 
if (!slab_list) {
slub_debug = flags;
global_slub_debug_changed = true;
} else {
slab_list_specified = true;  // 커멘드 라인에서 슬랩 캐시의 종류를 지정한 경우, slub_debug=P,kmalloc-*,dentry
}
}
 
if (slab_list_specified) {
if (!global_slub_debug_changed)
slub_debug = 0;
slub_debug_string = saved_str;
}
out:
if (slub_debug != 0 || slub_debug_string)
static_branch_enable(&slub_debug_enabled);
if ((static_branch_unlikely(&init_on_alloc) ||
     static_branch_unlikely(&init_on_free)) &&
    (slub_debug & SLAB_POISON))
pr_info("mem auto-init: SLAB_POISON will take precedence over init_on_alloc/init_on_free\n");
return 1;
}
__setup("slub_debug", setup_slub_debug);
 
  (static struct kmem_cache * [14]) kmalloc_caches = (
    [0] = 0x0 =  -> NULL,
    [1] = 0x0 =  -> NULL,
    [2] = 0x0 =  -> NULL,
    [3] = 0x0 =  -> NULL,
    [4] = 0x0 =  -> NULL,
    [5] = 0x0 =  -> NULL,
    [6] = 0x0 =  -> NULL,
    [7] = 0xFFFFFFD33FC20400 // "kmalloc-64"
    [8] = 0xFFFFFFD33FC27780 // "kmalloc-128"
    [9] = 0xFFFFFFD33FC20780 // "kmalloc-256"
    [10] = 0xFFFFFFD33FC27400 
    [11] = 0xFFFFFFD33FC20B00 
    [12] = 0xFFFFFFD33FC27080 
    [13] = 0xFFFFFFD33FC20E80 // "kmalloc-8192"

+ Recent posts