slub: do not merge cache if slub_debug contains a never-merge flag
Subsystems (2)
PATCH 1/1 slub: do not merge cache if slub_debug contains a never-merge flag
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.
--- mm/slab_common.c | 3 +++ 1 file changed, 3 insertions(+)
mm/slab_common.c +3 -0
@@ -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 ;
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Grygorii Maistrenko
In case
CONFIG_SLUB_DEBUG_ON=nfind_mergeable()gets debug features from commandline but never checks if there are features from theSLAB_NEVER_MERGEset.
As a result selected byslub_debugcaches 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,Quoted 15 lines
This adds the necessary check and makes selected slab caches unmergeable if one of the
SLAB_NEVER_MERGEfeatures is set from commandline.Signed-off-by Grygorii Maistrenko <[email protected]>--- mm/slab_common.c | 3 +++ 1 file changed, 3 insertions(+)mm/slab_common.c +0
-0
mm/slab_common.c struct kmem_cache *find_mergeable(size_t size, size_t align, · line 274
Quoted 9 lines
mm/slab_common.c +3
-0@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 12 lines · Christoph Lameter
Quoted 6 lines · Grygorii Maistrenko
In case
CONFIG_SLUB_DEBUG_ON=nfind_mergeable()gets debug features from commandline but never checks if there are features from theSLAB_NEVER_MERGEset.
As a result selected byslub_debugcaches 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!
Quoted 7 lines
struct
kmem_cache*ind_mergeable(size_t size,size_talign,
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().
Quoted 6 lines
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.
Quoted 19 lines
Quoted 19 lines
This adds the necessary check and makes selected slab caches unmergeable if one of the
SLAB_NEVER_MERGEfeatures is set from commandline.Signed-off-by Grygorii Maistrenko <[email protected]>--- mm/slab_common.c | 3 +++ 1 file changed, 3 insertions(+)mm/slab_common.c +0
-0@@ -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 );
Quoted 7 lines
mm/slab_common.c struct kmem_cache *find_mergeable(size_t size, size_t align, · line 274
Quoted 7 lines
mm/slab_common.c +3
-0+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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 14 lines · Grygorii Maistrenko
Quoted 7 lines
struct
kmem_cache*ind_mergeable(size_t size,size_talign,
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().Quoted 4 lines
if (ctor) return NULL;
Quoted 6 lines
Quoted 2 lines
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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 1/1 slub: do not merge cache if slub_debug contains a never-merge flag
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.
--- 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
mm/slab_common.c +4 -1
@@ -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 ;
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines · Grygorii Maistrenko
In case
CONFIG_SLUB_DEBUG_ON=n,find_mergeable()gets debug features from commandline but never checks if there are features from theSLAB_NEVER_MERGEset.
As a result selected byslub_debugcaches are always mergeable if they have been created without a custom constructor set or without one of the SLAB_* debug features on.
Quoted 5 lines
This moves the
SLAB_NEVER_MERGEcheck 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 <[email protected]>
Quoted 22 lines
--- 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 Lametermm/slab_common.c +1
-1@@ -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)
mm/slab_common.c struct kmem_cache *find_mergeable(size_t size, size_t align, · line 274
Quoted 9 lines
mm/slab_common.c +3
-0@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines · Grygorii Maistrenko
In case
CONFIG_SLUB_DEBUG_ON=n,find_mergeable()gets debug features from commandline but never checks if there are features from theSLAB_NEVER_MERGEset.
As a result selected byslub_debugcaches are always mergeable if they have been created without a custom constructor set or without one of the SLAB_* debug features on.
Quoted 5 lines
This moves the
SLAB_NEVER_MERGEcheck 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 <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 1/1 slub: do not merge cache if slub_debug contains a never-merge flag
In reply to Christoph LameterIn 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.
--- 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
mm/slab_common.c +4 -1
@@ -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 ;
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>