Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

slab: convert setup_slub_debug() to use __core_param_cb()

Use __core_param_cb() to parse the "slab_debug" kernel parameter instead of
the obsolescent __setup(). For now, the parameter is not exposed in sysfs,
and no get ops is provided.

There is a slight change in behavior. Before this patch, the following
parameter would silently turn on full debugging for all slabs:

slub_debug_yada_yada_gotta_love_this=hail_satan!

This syntax is now rejected, and the parameter will be passed to user
space, making the kernel a holier place.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Link: https://patch.msgid.link/9674b34861394088c7853edf8e9d2b439fd4b42f.1761324765.git.ptesarik@suse.com
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

authored by

Petr Tesarik and committed by
Vlastimil Babka
aed760df d3722ff5

+9 -6
+9 -6
mm/slub.c
··· 1863 1863 return NULL; 1864 1864 } 1865 1865 1866 - static int __init setup_slub_debug(char *val) 1866 + static int __init setup_slub_debug(const char *str, const struct kernel_param *kp) 1867 1867 { 1868 1868 slab_flags_t flags; 1869 1869 slab_flags_t global_flags; ··· 1871 1871 const char *slab_list; 1872 1872 bool global_slub_debug_changed = false; 1873 1873 bool slab_list_specified = false; 1874 - const char *str = val; 1875 1874 1876 1875 global_flags = DEBUG_DEFAULT_FLAGS; 1877 - if (*str++ != '=' || !*str) 1876 + if (!str || !*str) 1878 1877 /* 1879 1878 * No options specified. Switch on full debugging. 1880 1879 */ ··· 1917 1918 static_branch_unlikely(&init_on_free)) && 1918 1919 (slub_debug & SLAB_POISON)) 1919 1920 pr_info("mem auto-init: SLAB_POISON will take precedence over init_on_alloc/init_on_free\n"); 1920 - return 1; 1921 + return 0; 1921 1922 } 1922 1923 1923 - __setup("slab_debug", setup_slub_debug); 1924 - __setup_param("slub_debug", slub_debug, setup_slub_debug, 0); 1924 + static const struct kernel_param_ops param_ops_slab_debug __initconst = { 1925 + .flags = KERNEL_PARAM_OPS_FL_NOARG, 1926 + .set = setup_slub_debug, 1927 + }; 1928 + __core_param_cb(slab_debug, &param_ops_slab_debug, NULL, 0); 1929 + __core_param_cb(slub_debug, &param_ops_slab_debug, NULL, 0); 1925 1930 1926 1931 /* 1927 1932 * kmem_cache_flags - apply debugging options to the cache