mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
mm/slab: Optimize the code logic in find_mergeable()
We can first assess the flags, if it's unmergeable, there's no need to calculate the size and align. Signed-off-by: Xavier <xavier_qy@163.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
parent
59090e479a
commit
e02147cb70
@ -186,14 +186,15 @@ struct kmem_cache *find_mergeable(unsigned int size, unsigned int align,
|
||||
if (ctor)
|
||||
return NULL;
|
||||
|
||||
size = ALIGN(size, sizeof(void *));
|
||||
align = calculate_alignment(flags, align, size);
|
||||
size = ALIGN(size, align);
|
||||
flags = kmem_cache_flags(flags, name);
|
||||
|
||||
if (flags & SLAB_NEVER_MERGE)
|
||||
return NULL;
|
||||
|
||||
size = ALIGN(size, sizeof(void *));
|
||||
align = calculate_alignment(flags, align, size);
|
||||
size = ALIGN(size, align);
|
||||
|
||||
list_for_each_entry_reverse(s, &slab_caches, list) {
|
||||
if (slab_unmergeable(s))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user