Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1575900

Re: [PATCH] slub: make sysfs directories for memcg sub-caches optional

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] slub: make sysfs directories for memcg sub-caches optional
Date 2017-02-07 18:20 +0100
Message-ID <t8hAS-5JV-17@gated-at.bofh.it> (permalink)
References <t79YK-1T2-11@gated-at.bofh.it> <t81Pr-3N7-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello, Andrew.

On Mon, Feb 06, 2017 at 04:22:13PM -0800, Andrew Morton wrote:
> >  #ifdef CONFIG_MEMCG
> > -	if (is_root_cache(s)) {
> > +	if (is_root_cache(s) && memcg_sysfs_enabled) {
> 
> This could be turned on and off after bootup but I guess the result
> could be pretty confusing.
> 
> However there would be useful use cases?  The user would normally have
> this disabled but if he wants to do a bit of debugging then turn this
> on, create a memcg, have a poke around then turn the feature off again.

Hmm... maybe.  It's somewhat nasty to do after-the-fact.  You would
have to re-walk all the caches to create and destroy the sysfs
entries.  Given that it's a pretty fringe debug feature, I'm not sure
the added complexity would be justified.

> >  		s->memcg_kset = kset_create_and_add("cgroup", NULL, &s->kobj);
> >  		if (!s->memcg_kset) {
> >  			err = -ENOMEM;
> > @@ -5673,7 +5695,8 @@ static void sysfs_slab_remove(struct kme
> >  		return;
> >  
> >  #ifdef CONFIG_MEMCG
> > -	kset_unregister(s->memcg_kset);
> > +	if (s->memcg_kset)
> > +		kset_unregister(s->memcg_kset);
> 
> kset_unregister(NULL) is legal
> 
> --- a/mm/slub.c~slub-make-sysfs-directories-for-memcg-sub-caches-optional-fix
> +++ a/mm/slub.c
> @@ -5699,8 +5699,7 @@ static void sysfs_slab_remove(struct kme
>  		return;
>  
>  #ifdef CONFIG_MEMCG
> -	if (s->memcg_kset)
> -		kset_unregister(s->memcg_kset);
> +	kset_unregister(s->memcg_kset);
>  #endif
>  	kobject_uevent(&s->kobj, KOBJ_REMOVE);
>  	kobject_del(&s->kobj);

Ah, of course, looks good to me.

Thanks.

-- 
tejun

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] slub: make sysfs directories for memcg sub-caches optional Tejun Heo <tj@kernel.org> - 2017-02-04 16:00 +0100
  Re: [PATCH] slub: make sysfs directories for memcg sub-caches  optional Andrew Morton <akpm@linux-foundation.org> - 2017-02-07 01:30 +0100
    Re: [PATCH] slub: make sysfs directories for memcg sub-caches  optional Tejun Heo <tj@kernel.org> - 2017-02-07 18:20 +0100

csiph-web