Skip to content

Commit aff8518

Browse files
committed
mm/slab: make caches with sheaves mergeable
Before enabling sheaves for all caches (with automatically determined capacity), their enablement should no longer prevent merging of caches. Limit this merge prevention only to caches that were created with a specific sheaf capacity, by adding the SLAB_NO_MERGE flag to them. Reviewed-by: Harry Yoo <harry.yoo@oracle.com> Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
1 parent 8598351 commit aff8518

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

mm/slab_common.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ int slab_unmergeable(struct kmem_cache *s)
162162
return 1;
163163
#endif
164164

165-
if (s->cpu_sheaves)
166-
return 1;
167-
168165
/*
169166
* We may have set a slab to be unmergeable during bootstrap.
170167
*/
@@ -189,9 +186,6 @@ static struct kmem_cache *find_mergeable(unsigned int size, slab_flags_t flags,
189186
if (IS_ENABLED(CONFIG_HARDENED_USERCOPY) && args->usersize)
190187
return NULL;
191188

192-
if (args->sheaf_capacity)
193-
return NULL;
194-
195189
flags = kmem_cache_flags(flags, name);
196190

197191
if (flags & SLAB_NEVER_MERGE)
@@ -336,6 +330,13 @@ struct kmem_cache *__kmem_cache_create_args(const char *name,
336330
flags &= ~SLAB_DEBUG_FLAGS;
337331
#endif
338332

333+
/*
334+
* Caches with specific capacity are special enough. It's simpler to
335+
* make them unmergeable.
336+
*/
337+
if (args->sheaf_capacity)
338+
flags |= SLAB_NO_MERGE;
339+
339340
mutex_lock(&slab_mutex);
340341

341342
err = kmem_cache_sanity_check(name, object_size);

0 commit comments

Comments
 (0)