* [PATCH] slub: do not merge cache if slub_debug contains a never-merge flag
@ 2016-12-22 23:59 Grygorii Maistrenko
2016-12-23 18:30 ` Christoph Lameter
0 siblings, 1 reply; 9+ messages in thread
From: Grygorii Maistrenko @ 2016-12-22 23:59 UTC (permalink / raw)
To: linux-mm
Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
Andrew Morton
In case CONFIG_SLUB_DEBUG_ON=n find_mergeable() gets debug features
from commandline but never checks if there are features from the
SLAB_NEVER_MERGE set.
As a result selected by slub_debug caches are always mergeable if they
have been created without a custom constructor set or without one of the
SLAB_* debug features on.
This adds the necessary check and makes selected slab caches unmergeable
if one of the SLAB_NEVER_MERGE features is set from commandline.
Signed-off-by: Grygorii Maistrenko <grygoriimkd@gmail.com>
---
mm/slab_common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 329b03843863..7341cba8c58b 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
size = ALIGN(size, align);
flags = kmem_cache_flags(size, flags, name, NULL);
+ if (flags & SLAB_NEVER_MERGE)
+ return NULL;
+
list_for_each_entry_reverse(s, &slab_caches, list) {
if (slab_unmergeable(s))
continue;
--
2.11.0
--
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 related [flat|nested] 9+ messages in thread
* Re: [PATCH] slub: do not merge cache if slub_debug contains a never-merge flag
2016-12-22 23:59 [PATCH] slub: do not merge cache if slub_debug contains a never-merge flag Grygorii Maistrenko
@ 2016-12-23 18:30 ` Christoph Lameter
2016-12-23 19:00 ` Grygorii Maistrenko
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2016-12-23 18:30 UTC (permalink / raw)
To: Grygorii Maistrenko
Cc: linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton
On Fri, 23 Dec 2016, Grygorii Maistrenko wrote:
> In case CONFIG_SLUB_DEBUG_ON=n find_mergeable() gets debug features
> from commandline but never checks if there are features from the
> SLAB_NEVER_MERGE set.
> As a result selected by slub_debug caches are always mergeable if they
> have been created without a custom constructor set or without one of the
> SLAB_* debug features on.
WTF is this nonsense? That check is done a few lines earlier!
struct kmem_cache *ind_mergeable(size_t size, size_t align,
unsigned long flags, const char *name, void (*ctor)(void *))
{
struct kmem_cache *s;
if (slab_nomerge || (flags & SLAB_NEVER_MERGE)) <----- !!!!!!
return NULL;
if (ctor)
return NULL;
size = ALIGN(size, sizeof(void *));
align = calculate_alignment(flags,
>
> This adds the necessary check and makes selected slab caches unmergeable
> if one of the SLAB_NEVER_MERGE features is set from commandline.
>
> Signed-off-by: Grygorii Maistrenko <grygoriimkd@gmail.com>
> ---
> mm/slab_common.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 329b03843863..7341cba8c58b 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
> size = ALIGN(size, align);
> flags = kmem_cache_flags(size, flags, name, NULL);
>
> + if (flags & SLAB_NEVER_MERGE)
> + return NULL;
> +
> list_for_each_entry_reverse(s, &slab_caches, list) {
> if (slab_unmergeable(s))
> continue;
>
--
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] 9+ messages in thread
* Re: [PATCH] slub: do not merge cache if slub_debug contains a never-merge flag
2016-12-23 18:30 ` Christoph Lameter
@ 2016-12-23 19:00 ` Grygorii Maistrenko
2016-12-24 23:09 ` Christoph Lameter
0 siblings, 1 reply; 9+ messages in thread
From: Grygorii Maistrenko @ 2016-12-23 19:00 UTC (permalink / raw)
To: Christoph Lameter
Cc: linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton
On Fri, Dec 23, 2016 at 12:30:02PM -0600, Christoph Lameter wrote:
>
> On Fri, 23 Dec 2016, Grygorii Maistrenko wrote:
>
> > In case CONFIG_SLUB_DEBUG_ON=n find_mergeable() gets debug features
> > from commandline but never checks if there are features from the
> > SLAB_NEVER_MERGE set.
> > As a result selected by slub_debug caches are always mergeable if they
> > have been created without a custom constructor set or without one of the
> > SLAB_* debug features on.
>
> WTF is this nonsense? That check is done a few lines earlier!
>
> struct kmem_cache *ind_mergeable(size_t size, size_t align,
> unsigned long flags, const char *name, void (*ctor)(void *))
> {
> struct kmem_cache *s;
>
> if (slab_nomerge || (flags & SLAB_NEVER_MERGE)) <----- !!!!!!
> return NULL;
This one check is done on flags passed to kmem_cache_create().
>
> if (ctor)
> return NULL;
>
> size = ALIGN(size, sizeof(void *));
> align = calculate_alignment(flags,
flags = kmem_cache_flags(size, flags, name, NULL);
I added here the missing line. This updates flags from commandline and
after this we do not check it.
>
>
> >
> > This adds the necessary check and makes selected slab caches unmergeable
> > if one of the SLAB_NEVER_MERGE features is set from commandline.
> >
> > Signed-off-by: Grygorii Maistrenko <grygoriimkd@gmail.com>
> > ---
> > mm/slab_common.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/mm/slab_common.c b/mm/slab_common.c
> > index 329b03843863..7341cba8c58b 100644
> > --- a/mm/slab_common.c
> > +++ b/mm/slab_common.c
> > @@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
> > size = ALIGN(size, align);
> > flags = kmem_cache_flags(size, flags, name, NULL);
> >
> > + if (flags & SLAB_NEVER_MERGE)
> > + return NULL;
> > +
> > list_for_each_entry_reverse(s, &slab_caches, list) {
> > if (slab_unmergeable(s))
> > continue;
> >
--
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] 9+ messages in thread
* Re: [PATCH] slub: do not merge cache if slub_debug contains a never-merge flag
2016-12-23 19:00 ` Grygorii Maistrenko
@ 2016-12-24 23:09 ` Christoph Lameter
2016-12-26 19:08 ` [PATCH v2] " Grygorii Maistrenko
2017-01-01 12:44 ` Grygorii Maistrenko
0 siblings, 2 replies; 9+ messages in thread
From: Christoph Lameter @ 2016-12-24 23:09 UTC (permalink / raw)
To: Grygorii Maistrenko
Cc: linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton
On Fri, 23 Dec 2016, Grygorii Maistrenko wrote:
> > struct kmem_cache *ind_mergeable(size_t size, size_t align,
> > unsigned long flags, const char *name, void (*ctor)(void *))
> > {
> > struct kmem_cache *s;
> >
> > if (slab_nomerge || (flags & SLAB_NEVER_MERGE)) <----- !!!!!!
> > return NULL;
>
> This one check is done on flags passed to kmem_cache_create().
>
> >
> > if (ctor)
> > return NULL;
> >
> > size = ALIGN(size, sizeof(void *));
> > align = calculate_alignment(flags,
> flags = kmem_cache_flags(size, flags, name, NULL);
>
> I added here the missing line. This updates flags from commandline and
> after this we do not check it.
Then please move the check down below the flags update.
--
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] 9+ messages in thread
* [PATCH v2] slub: do not merge cache if slub_debug contains a never-merge flag
2016-12-24 23:09 ` Christoph Lameter
@ 2016-12-26 19:08 ` Grygorii Maistrenko
2016-12-27 9:50 ` Pekka Enberg
2016-12-28 0:17 ` David Rientjes
2017-01-01 12:44 ` Grygorii Maistrenko
1 sibling, 2 replies; 9+ messages in thread
From: Grygorii Maistrenko @ 2016-12-26 19:08 UTC (permalink / raw)
To: Christoph Lameter
Cc: linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton
In case CONFIG_SLUB_DEBUG_ON=n, find_mergeable() gets debug features
from commandline but never checks if there are features from the
SLAB_NEVER_MERGE set.
As a result selected by slub_debug caches are always mergeable if they
have been created without a custom constructor set or without one of the
SLAB_* debug features on.
This moves the SLAB_NEVER_MERGE check below the flags update from
commandline to make sure it won't merge the slab cache if one of the
debug features is on.
Signed-off-by: Grygorii Maistrenko <grygoriimkd@gmail.com>
---
mm/slab_common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New in v2:
- (flags & SLAB_NEVER_MERGE) check is moved down below the flags update
as suggested by Christoph Lameter
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 329b03843863..a85a01439490 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -255,7 +255,7 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
{
struct kmem_cache *s;
- if (slab_nomerge || (flags & SLAB_NEVER_MERGE))
+ if (slab_nomerge)
return NULL;
if (ctor)
@@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
size = ALIGN(size, align);
flags = kmem_cache_flags(size, flags, name, NULL);
+ if (flags & SLAB_NEVER_MERGE)
+ return NULL;
+
list_for_each_entry_reverse(s, &slab_caches, list) {
if (slab_unmergeable(s))
continue;
--
2.11.0
--
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 related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] slub: do not merge cache if slub_debug contains a never-merge flag
2016-12-26 19:08 ` [PATCH v2] " Grygorii Maistrenko
@ 2016-12-27 9:50 ` Pekka Enberg
2016-12-28 0:17 ` David Rientjes
1 sibling, 0 replies; 9+ messages in thread
From: Pekka Enberg @ 2016-12-27 9:50 UTC (permalink / raw)
To: Grygorii Maistrenko, Christoph Lameter
Cc: linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton
On 12/26/2016 09:08 PM, Grygorii Maistrenko wrote:
> In case CONFIG_SLUB_DEBUG_ON=n, find_mergeable() gets debug features
> from commandline but never checks if there are features from the
> SLAB_NEVER_MERGE set.
> As a result selected by slub_debug caches are always mergeable if they
> have been created without a custom constructor set or without one of the
> SLAB_* debug features on.
>
> This moves the SLAB_NEVER_MERGE check below the flags update from
> commandline to make sure it won't merge the slab cache if one of the
> debug features is on.
>
> Signed-off-by: Grygorii Maistrenko <grygoriimkd@gmail.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
> ---
> mm/slab_common.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> New in v2:
> - (flags & SLAB_NEVER_MERGE) check is moved down below the flags update
> as suggested by Christoph Lameter
>
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 329b03843863..a85a01439490 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -255,7 +255,7 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
> {
> struct kmem_cache *s;
>
> - if (slab_nomerge || (flags & SLAB_NEVER_MERGE))
> + if (slab_nomerge)
> return NULL;
>
> if (ctor)
> @@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
> size = ALIGN(size, align);
> flags = kmem_cache_flags(size, flags, name, NULL);
>
> + if (flags & SLAB_NEVER_MERGE)
> + return NULL;
> +
> list_for_each_entry_reverse(s, &slab_caches, list) {
> if (slab_unmergeable(s))
> continue;
--
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] 9+ messages in thread
* Re: [PATCH v2] slub: do not merge cache if slub_debug contains a never-merge flag
2016-12-26 19:08 ` [PATCH v2] " Grygorii Maistrenko
2016-12-27 9:50 ` Pekka Enberg
@ 2016-12-28 0:17 ` David Rientjes
1 sibling, 0 replies; 9+ messages in thread
From: David Rientjes @ 2016-12-28 0:17 UTC (permalink / raw)
To: Grygorii Maistrenko
Cc: Christoph Lameter, linux-mm, Pekka Enberg, Joonsoo Kim, Andrew Morton
On Mon, 26 Dec 2016, Grygorii Maistrenko wrote:
> In case CONFIG_SLUB_DEBUG_ON=n, find_mergeable() gets debug features
> from commandline but never checks if there are features from the
> SLAB_NEVER_MERGE set.
> As a result selected by slub_debug caches are always mergeable if they
> have been created without a custom constructor set or without one of the
> SLAB_* debug features on.
>
> This moves the SLAB_NEVER_MERGE check below the flags update from
> commandline to make sure it won't merge the slab cache if one of the
> debug features is on.
>
> Signed-off-by: Grygorii Maistrenko <grygoriimkd@gmail.com>
Acked-by: David Rientjes <rientjes@google.com>
--
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] 9+ messages in thread
* [PATCH v2] slub: do not merge cache if slub_debug contains a never-merge flag
2016-12-24 23:09 ` Christoph Lameter
2016-12-26 19:08 ` [PATCH v2] " Grygorii Maistrenko
@ 2017-01-01 12:44 ` Grygorii Maistrenko
2017-01-04 15:55 ` Christoph Lameter
1 sibling, 1 reply; 9+ messages in thread
From: Grygorii Maistrenko @ 2017-01-01 12:44 UTC (permalink / raw)
To: Christoph Lameter
Cc: linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton
In case CONFIG_SLUB_DEBUG_ON=n, find_mergeable() gets debug features
from commandline but never checks if there are features from the
SLAB_NEVER_MERGE set.
As a result selected by slub_debug caches are always mergeable if they
have been created without a custom constructor set or without one of the
SLAB_* debug features on.
This moves the SLAB_NEVER_MERGE check below the flags update from
commandline to make sure it won't merge the slab cache if one of the
debug features is on.
Signed-off-by: Grygorii Maistrenko <grygoriimkd@gmail.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
---
mm/slab_common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New in v2:
- (flags & SLAB_NEVER_MERGE) check is moved down below the flags update
as suggested by Christoph Lameter
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 329b03843863..a85a01439490 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -255,7 +255,7 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
{
struct kmem_cache *s;
- if (slab_nomerge || (flags & SLAB_NEVER_MERGE))
+ if (slab_nomerge)
return NULL;
if (ctor)
@@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
size = ALIGN(size, align);
flags = kmem_cache_flags(size, flags, name, NULL);
+ if (flags & SLAB_NEVER_MERGE)
+ return NULL;
+
list_for_each_entry_reverse(s, &slab_caches, list) {
if (slab_unmergeable(s))
continue;
--
2.11.0
--
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 related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] slub: do not merge cache if slub_debug contains a never-merge flag
2017-01-01 12:44 ` Grygorii Maistrenko
@ 2017-01-04 15:55 ` Christoph Lameter
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Lameter @ 2017-01-04 15:55 UTC (permalink / raw)
To: Grygorii Maistrenko
Cc: linux-mm, Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton
Acked-by: Christoph Lameter <cl@linux.com
--
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] 9+ messages in thread
end of thread, other threads:[~2017-01-04 15:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22 23:59 [PATCH] slub: do not merge cache if slub_debug contains a never-merge flag Grygorii Maistrenko
2016-12-23 18:30 ` Christoph Lameter
2016-12-23 19:00 ` Grygorii Maistrenko
2016-12-24 23:09 ` Christoph Lameter
2016-12-26 19:08 ` [PATCH v2] " Grygorii Maistrenko
2016-12-27 9:50 ` Pekka Enberg
2016-12-28 0:17 ` David Rientjes
2017-01-01 12:44 ` Grygorii Maistrenko
2017-01-04 15:55 ` Christoph Lameter
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.