Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+7 -6
+7 -6
mm/slab_common.c
··· 162 162 return 1; 163 163 #endif 164 164 165 - if (s->cpu_sheaves) 166 - return 1; 167 - 168 165 /* 169 166 * We may have set a slab to be unmergeable during bootstrap. 170 167 */ ··· 184 187 return NULL; 185 188 186 189 if (IS_ENABLED(CONFIG_HARDENED_USERCOPY) && args->usersize) 187 - return NULL; 188 - 189 - if (args->sheaf_capacity) 190 190 return NULL; 191 191 192 192 flags = kmem_cache_flags(flags, name); ··· 329 335 #else 330 336 flags &= ~SLAB_DEBUG_FLAGS; 331 337 #endif 338 + 339 + /* 340 + * Caches with specific capacity are special enough. It's simpler to 341 + * make them unmergeable. 342 + */ 343 + if (args->sheaf_capacity) 344 + flags |= SLAB_NO_MERGE; 332 345 333 346 mutex_lock(&slab_mutex); 334 347