projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f4957d5
)
slab: make size_index[] array u8
author
Alexey Dobriyan
<
[email protected]
>
Thu, 5 Apr 2018 23:20:40 +0000
(16:20 -0700)
committer
Linus Torvalds
<
[email protected]
>
Fri, 6 Apr 2018 04:36:23 +0000
(21:36 -0700)
All those small numbers are reverse indexes into kmalloc caches array
and can't be negative.
On x86_64 "unsigned int = fls()" can drop CDQE instruction:
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-2 (-2)
Function old new delta
kmalloc_slab 101 99 -2
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Alexey Dobriyan <
[email protected]
>
Acked-by: Christoph Lameter <
[email protected]
>
Cc: Pekka Enberg <
[email protected]
>
Cc: David Rientjes <
[email protected]
>
Cc: Joonsoo Kim <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
mm/slab_common.c
patch
|
blob
|
history
diff --git
a/mm/slab_common.c
b/mm/slab_common.c
index a4545a61a7c858ed58fa34899f253094756ccfd2..dda966e6bc58945d5263d406e8c1823bbb363beb 100644
(file)
--- a/
mm/slab_common.c
+++ b/
mm/slab_common.c
@@
-971,7
+971,7
@@
EXPORT_SYMBOL(kmalloc_dma_caches);
* of two cache sizes there. The size of larger slabs can be determined using
* fls.
*/
-static
s
8 size_index[24] __ro_after_init = {
+static
u
8 size_index[24] __ro_after_init = {
3, /* 8 */
4, /* 16 */
5, /* 24 */
@@
-1009,7
+1009,7
@@
static inline int size_index_elem(size_t bytes)
*/
struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
{
- int index;
+
unsigned
int index;
if (unlikely(size > KMALLOC_MAX_SIZE)) {
WARN_ON_ONCE(!(flags & __GFP_NOWARN));