diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-07-17 04:03:26 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 10:23:01 -0700 |
commit | f1b263393626fe66bee34ccdbf0487cd377e0213 (patch) | |
tree | c144c6f8c0fd8f5eeeac1504bf7204c09938135f /scripts/genksyms | |
parent | dfce8648d64c07eade40d456d59cb4bfcbba008c (diff) | |
download | lwn-f1b263393626fe66bee34ccdbf0487cd377e0213.tar.gz lwn-f1b263393626fe66bee34ccdbf0487cd377e0213.zip |
SLUB: faster more efficient slab determination for __kmalloc
kmalloc_index is a long series of comparisons. The attempt to replace
kmalloc_index with something more efficient like ilog2 failed due to compiler
issues with constant folding on gcc 3.3 / powerpc.
kmalloc_index()'es long list of comparisons works fine for constant folding
since all the comparisons are optimized away. However, SLUB also uses
kmalloc_index to determine the slab to use for the __kmalloc_xxx functions.
This leads to a large set of comparisons in get_slab().
The patch here allows to get rid of that list of comparisons in get_slab():
1. If the requested size is larger than 192 then we can simply use
fls to determine the slab index since all larger slabs are
of the power of two type.
2. If the requested size is smaller then we cannot use fls since there
are non power of two caches to be considered. However, the sizes are
in a managable range. So we divide the size by 8. Then we have only
24 possibilities left and then we simply look up the kmalloc index
in a table.
Code size of slub.o decreases by more than 200 bytes through this patch.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/genksyms')
0 files changed, 0 insertions, 0 deletions