* + slub-fix-memcg_propagate_slab_attrs.patch added to -mm tree
@ 2014-04-18 20:08 akpm
2014-04-22 10:30 ` Michal Hocko
0 siblings, 1 reply; 4+ messages in thread
From: akpm @ 2014-04-18 20:08 UTC (permalink / raw)
To: mm-commits, penberg, mhocko, hannes, cl, vdavydov
Subject: + slub-fix-memcg_propagate_slab_attrs.patch added to -mm tree
To: vdavydov@parallels.com,cl@linux.com,hannes@cmpxchg.org,mhocko@suse.cz,penberg@kernel.org
From: akpm@linux-foundation.org
Date: Fri, 18 Apr 2014 13:08:17 -0700
The patch titled
Subject: slub: fix memcg_propagate_slab_attrs
has been added to the -mm tree. Its filename is
slub-fix-memcg_propagate_slab_attrs.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/slub-fix-memcg_propagate_slab_attrs.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/slub-fix-memcg_propagate_slab_attrs.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Vladimir Davydov <vdavydov@parallels.com>
Subject: slub: fix memcg_propagate_slab_attrs
After creating a cache for a memcg we should initialize its sysfs attrs
with the values from its parent. That's what memcg_propagate_slab_attrs
is for. Currently it's broken - we clearly muddled root-vs-memcg caches
there. Let's fix it up.
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/slub.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff -puN mm/slub.c~slub-fix-memcg_propagate_slab_attrs mm/slub.c
--- a/mm/slub.c~slub-fix-memcg_propagate_slab_attrs
+++ a/mm/slub.c
@@ -5071,15 +5071,18 @@ static void memcg_propagate_slab_attrs(s
#ifdef CONFIG_MEMCG_KMEM
int i;
char *buffer = NULL;
+ struct kmem_cache *root_cache;
- if (!is_root_cache(s))
+ if (is_root_cache(s))
return;
+ root_cache = s->memcg_params->root_cache;
+
/*
* This mean this cache had no attribute written. Therefore, no point
* in copying default values around
*/
- if (!s->max_attr_size)
+ if (!root_cache->max_attr_size)
return;
for (i = 0; i < ARRAY_SIZE(slab_attrs); i++) {
@@ -5101,7 +5104,7 @@ static void memcg_propagate_slab_attrs(s
*/
if (buffer)
buf = buffer;
- else if (s->max_attr_size < ARRAY_SIZE(mbuf))
+ else if (root_cache->max_attr_size < ARRAY_SIZE(mbuf))
buf = mbuf;
else {
buffer = (char *) get_zeroed_page(GFP_KERNEL);
@@ -5110,7 +5113,7 @@ static void memcg_propagate_slab_attrs(s
buf = buffer;
}
- attr->show(s->memcg_params->root_cache, buf);
+ attr->show(root_cache, buf);
attr->store(s, buf, strlen(buf));
}
_
Patches currently in -mm which might be from vdavydov@parallels.com are
slub-fix-memcg_propagate_slab_attrs.patch
slb-charge-slabs-to-kmemcg-explicitly.patch
mm-get-rid-of-__gfp_kmemcg.patch
mm-get-rid-of-__gfp_kmemcg-fix.patch
slab-document-kmalloc_order.patch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: + slub-fix-memcg_propagate_slab_attrs.patch added to -mm tree
2014-04-18 20:08 + slub-fix-memcg_propagate_slab_attrs.patch added to -mm tree akpm
@ 2014-04-22 10:30 ` Michal Hocko
2014-04-22 10:52 ` Vladimir Davydov
0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2014-04-22 10:30 UTC (permalink / raw)
To: Vladimir Davydov; +Cc: mm-commits, penberg, hannes, cl, linux-mm, Andrew Morton
On Fri 18-04-14 13:08:17, Andrew Morton wrote:
[...]
> From: Vladimir Davydov <vdavydov@parallels.com>
> Subject: slub: fix memcg_propagate_slab_attrs
>
> After creating a cache for a memcg we should initialize its sysfs attrs
> with the values from its parent. That's what memcg_propagate_slab_attrs
> is for. Currently it's broken - we clearly muddled root-vs-memcg caches
> there. Let's fix it up.
Andrew didn't so I'll do. What is the effect of the mismatch? I am
really drowning in that code...
> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/slub.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff -puN mm/slub.c~slub-fix-memcg_propagate_slab_attrs mm/slub.c
> --- a/mm/slub.c~slub-fix-memcg_propagate_slab_attrs
> +++ a/mm/slub.c
> @@ -5071,15 +5071,18 @@ static void memcg_propagate_slab_attrs(s
> #ifdef CONFIG_MEMCG_KMEM
> int i;
> char *buffer = NULL;
> + struct kmem_cache *root_cache;
>
> - if (!is_root_cache(s))
> + if (is_root_cache(s))
> return;
>
> + root_cache = s->memcg_params->root_cache;
> +
> /*
> * This mean this cache had no attribute written. Therefore, no point
> * in copying default values around
> */
> - if (!s->max_attr_size)
> + if (!root_cache->max_attr_size)
> return;
>
> for (i = 0; i < ARRAY_SIZE(slab_attrs); i++) {
> @@ -5101,7 +5104,7 @@ static void memcg_propagate_slab_attrs(s
> */
> if (buffer)
> buf = buffer;
> - else if (s->max_attr_size < ARRAY_SIZE(mbuf))
> + else if (root_cache->max_attr_size < ARRAY_SIZE(mbuf))
> buf = mbuf;
> else {
> buffer = (char *) get_zeroed_page(GFP_KERNEL);
> @@ -5110,7 +5113,7 @@ static void memcg_propagate_slab_attrs(s
> buf = buffer;
> }
>
> - attr->show(s->memcg_params->root_cache, buf);
> + attr->show(root_cache, buf);
> attr->store(s, buf, strlen(buf));
> }
>
> _
>
> Patches currently in -mm which might be from vdavydov@parallels.com are
>
> slub-fix-memcg_propagate_slab_attrs.patch
> slb-charge-slabs-to-kmemcg-explicitly.patch
> mm-get-rid-of-__gfp_kmemcg.patch
> mm-get-rid-of-__gfp_kmemcg-fix.patch
> slab-document-kmalloc_order.patch
>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: + slub-fix-memcg_propagate_slab_attrs.patch added to -mm tree
2014-04-22 10:30 ` Michal Hocko
@ 2014-04-22 10:52 ` Vladimir Davydov
2014-04-22 12:04 ` Michal Hocko
0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Davydov @ 2014-04-22 10:52 UTC (permalink / raw)
To: Michal Hocko; +Cc: mm-commits, penberg, hannes, cl, linux-mm, Andrew Morton
On 04/22/2014 02:30 PM, Michal Hocko wrote:
> On Fri 18-04-14 13:08:17, Andrew Morton wrote:
> [...]
>> From: Vladimir Davydov <vdavydov@parallels.com>
>> Subject: slub: fix memcg_propagate_slab_attrs
>>
>> After creating a cache for a memcg we should initialize its sysfs attrs
>> with the values from its parent. That's what memcg_propagate_slab_attrs
>> is for. Currently it's broken - we clearly muddled root-vs-memcg caches
>> there. Let's fix it up.
>
> Andrew didn't so I'll do. What is the effect of the mismatch? I am
> really drowning in that code...
If we tune a kmem cache's params via sysfs and then create a memcg that
wants to allocate from the cache, the memcg's copy of the cache will
have default values of the sysfs params instead of those of the global
cache.
>
>> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
>> Cc: Christoph Lameter <cl@linux.com>
>> Cc: Pekka Enberg <penberg@kernel.org>
>> Cc: Michal Hocko <mhocko@suse.cz>
>> Cc: Johannes Weiner <hannes@cmpxchg.org>
>> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>> ---
>>
>> mm/slub.c | 11 +++++++----
>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff -puN mm/slub.c~slub-fix-memcg_propagate_slab_attrs mm/slub.c
>> --- a/mm/slub.c~slub-fix-memcg_propagate_slab_attrs
>> +++ a/mm/slub.c
>> @@ -5071,15 +5071,18 @@ static void memcg_propagate_slab_attrs(s
>> #ifdef CONFIG_MEMCG_KMEM
>> int i;
>> char *buffer = NULL;
>> + struct kmem_cache *root_cache;
>>
>> - if (!is_root_cache(s))
>> + if (is_root_cache(s))
>> return;
>>
>> + root_cache = s->memcg_params->root_cache;
>> +
>> /*
>> * This mean this cache had no attribute written. Therefore, no point
>> * in copying default values around
>> */
>> - if (!s->max_attr_size)
>> + if (!root_cache->max_attr_size)
>> return;
>>
>> for (i = 0; i < ARRAY_SIZE(slab_attrs); i++) {
>> @@ -5101,7 +5104,7 @@ static void memcg_propagate_slab_attrs(s
>> */
>> if (buffer)
>> buf = buffer;
>> - else if (s->max_attr_size < ARRAY_SIZE(mbuf))
>> + else if (root_cache->max_attr_size < ARRAY_SIZE(mbuf))
>> buf = mbuf;
>> else {
>> buffer = (char *) get_zeroed_page(GFP_KERNEL);
>> @@ -5110,7 +5113,7 @@ static void memcg_propagate_slab_attrs(s
>> buf = buffer;
>> }
>>
>> - attr->show(s->memcg_params->root_cache, buf);
>> + attr->show(root_cache, buf);
>> attr->store(s, buf, strlen(buf));
>> }
>>
>> _
>>
>> Patches currently in -mm which might be from vdavydov@parallels.com are
>>
>> slub-fix-memcg_propagate_slab_attrs.patch
>> slb-charge-slabs-to-kmemcg-explicitly.patch
>> mm-get-rid-of-__gfp_kmemcg.patch
>> mm-get-rid-of-__gfp_kmemcg-fix.patch
>> slab-document-kmalloc_order.patch
>>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: + slub-fix-memcg_propagate_slab_attrs.patch added to -mm tree
2014-04-22 10:52 ` Vladimir Davydov
@ 2014-04-22 12:04 ` Michal Hocko
0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2014-04-22 12:04 UTC (permalink / raw)
To: Vladimir Davydov; +Cc: mm-commits, penberg, hannes, cl, linux-mm, Andrew Morton
On Tue 22-04-14 14:52:57, Vladimir Davydov wrote:
> On 04/22/2014 02:30 PM, Michal Hocko wrote:
> > On Fri 18-04-14 13:08:17, Andrew Morton wrote:
> > [...]
> >> From: Vladimir Davydov <vdavydov@parallels.com>
> >> Subject: slub: fix memcg_propagate_slab_attrs
> >>
> >> After creating a cache for a memcg we should initialize its sysfs attrs
> >> with the values from its parent. That's what memcg_propagate_slab_attrs
> >> is for. Currently it's broken - we clearly muddled root-vs-memcg caches
> >> there. Let's fix it up.
> >
> > Andrew didn't so I'll do. What is the effect of the mismatch? I am
> > really drowning in that code...
>
> If we tune a kmem cache's params via sysfs and then create a memcg that
> wants to allocate from the cache, the memcg's copy of the cache will
> have default values of the sysfs params instead of those of the global
> cache.
Ahh, ok, I see. Thanks for the clarification.
> >> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
> >> Cc: Christoph Lameter <cl@linux.com>
> >> Cc: Pekka Enberg <penberg@kernel.org>
> >> Cc: Michal Hocko <mhocko@suse.cz>
> >> Cc: Johannes Weiner <hannes@cmpxchg.org>
> >> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> >> ---
> >>
> >> mm/slub.c | 11 +++++++----
> >> 1 file changed, 7 insertions(+), 4 deletions(-)
> >>
> >> diff -puN mm/slub.c~slub-fix-memcg_propagate_slab_attrs mm/slub.c
> >> --- a/mm/slub.c~slub-fix-memcg_propagate_slab_attrs
> >> +++ a/mm/slub.c
> >> @@ -5071,15 +5071,18 @@ static void memcg_propagate_slab_attrs(s
> >> #ifdef CONFIG_MEMCG_KMEM
> >> int i;
> >> char *buffer = NULL;
> >> + struct kmem_cache *root_cache;
> >>
> >> - if (!is_root_cache(s))
> >> + if (is_root_cache(s))
> >> return;
> >>
> >> + root_cache = s->memcg_params->root_cache;
> >> +
> >> /*
> >> * This mean this cache had no attribute written. Therefore, no point
> >> * in copying default values around
> >> */
> >> - if (!s->max_attr_size)
> >> + if (!root_cache->max_attr_size)
> >> return;
> >>
> >> for (i = 0; i < ARRAY_SIZE(slab_attrs); i++) {
> >> @@ -5101,7 +5104,7 @@ static void memcg_propagate_slab_attrs(s
> >> */
> >> if (buffer)
> >> buf = buffer;
> >> - else if (s->max_attr_size < ARRAY_SIZE(mbuf))
> >> + else if (root_cache->max_attr_size < ARRAY_SIZE(mbuf))
> >> buf = mbuf;
> >> else {
> >> buffer = (char *) get_zeroed_page(GFP_KERNEL);
> >> @@ -5110,7 +5113,7 @@ static void memcg_propagate_slab_attrs(s
> >> buf = buffer;
> >> }
> >>
> >> - attr->show(s->memcg_params->root_cache, buf);
> >> + attr->show(root_cache, buf);
> >> attr->store(s, buf, strlen(buf));
> >> }
> >>
> >> _
> >>
> >> Patches currently in -mm which might be from vdavydov@parallels.com are
> >>
> >> slub-fix-memcg_propagate_slab_attrs.patch
> >> slb-charge-slabs-to-kmemcg-explicitly.patch
> >> mm-get-rid-of-__gfp_kmemcg.patch
> >> mm-get-rid-of-__gfp_kmemcg-fix.patch
> >> slab-document-kmalloc_order.patch
> >>
> >
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-22 12:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-18 20:08 + slub-fix-memcg_propagate_slab_attrs.patch added to -mm tree akpm
2014-04-22 10:30 ` Michal Hocko
2014-04-22 10:52 ` Vladimir Davydov
2014-04-22 12:04 ` Michal Hocko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.