projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
59090e4
)
mm/slab: Optimize the code logic in find_mergeable()
author
Xavier
<xavier_qy@163.com>
Wed, 4 Sep 2024 07:40:37 +0000
(15:40 +0800)
committer
Vlastimil Babka
<vbabka@suse.cz>
Thu, 5 Sep 2024 12:42:23 +0000
(14:42 +0200)
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>
mm/slab_common.c
patch
|
blob
|
blame
|
history
diff --git
a/mm/slab_common.c
b/mm/slab_common.c
index ca694f5553b4e0138e2b8ecf5373711c107de913..85afeb69b3c07156daae821a0feaef2daa84a3fc 100644
(file)
--- a/
mm/slab_common.c
+++ b/
mm/slab_common.c
@@
-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;