mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 15:44:13 +08:00
Merge branch 'slab/for-6.2/slub-sysfs' into slab/for-next
- Two patches for SLUB's sysfs by Rasmus Villemoes to remove dead code and optimize boot time with late initialization. - Allow SLUB's sysfs 'failslab' parameter to be runtime-controllable again as it can be both useful and safe, by Alexander Atanasov.
This commit is contained in:
commit
c64b95d3dd
@ -116,6 +116,8 @@ options from the ``slub_debug`` parameter translate to the following files::
|
||||
T trace
|
||||
A failslab
|
||||
|
||||
failslab file is writable, so writing 1 or 0 will enable or disable
|
||||
the option at runtime. Write returns -EINVAL if cache is an alias.
|
||||
Careful with tracing: It may spew out lots of information and never stop if
|
||||
used on the wrong slab.
|
||||
|
||||
|
24
mm/slub.c
24
mm/slub.c
@ -5575,7 +5575,21 @@ static ssize_t failslab_show(struct kmem_cache *s, char *buf)
|
||||
{
|
||||
return sysfs_emit(buf, "%d\n", !!(s->flags & SLAB_FAILSLAB));
|
||||
}
|
||||
SLAB_ATTR_RO(failslab);
|
||||
|
||||
static ssize_t failslab_store(struct kmem_cache *s, const char *buf,
|
||||
size_t length)
|
||||
{
|
||||
if (s->refcount > 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (buf[0] == '1')
|
||||
WRITE_ONCE(s->flags, s->flags | SLAB_FAILSLAB);
|
||||
else
|
||||
WRITE_ONCE(s->flags, s->flags & ~SLAB_FAILSLAB);
|
||||
|
||||
return length;
|
||||
}
|
||||
SLAB_ATTR(failslab);
|
||||
#endif
|
||||
|
||||
static ssize_t shrink_show(struct kmem_cache *s, char *buf)
|
||||
@ -5909,11 +5923,6 @@ static int sysfs_slab_add(struct kmem_cache *s)
|
||||
struct kset *kset = cache_kset(s);
|
||||
int unmergeable = slab_unmergeable(s);
|
||||
|
||||
if (!kset) {
|
||||
kobject_init(&s->kobj, &slab_ktype);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!unmergeable && disable_higher_order_debug &&
|
||||
(slub_debug & DEBUG_METADATA_FLAGS))
|
||||
unmergeable = 1;
|
||||
@ -6043,8 +6052,7 @@ static int __init slab_sysfs_init(void)
|
||||
mutex_unlock(&slab_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
__initcall(slab_sysfs_init);
|
||||
late_initcall(slab_sysfs_init);
|
||||
#endif /* CONFIG_SYSFS */
|
||||
|
||||
#if defined(CONFIG_SLUB_DEBUG) && defined(CONFIG_DEBUG_FS)
|
||||
|
Loading…
Reference in New Issue
Block a user