summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux-foundation.org>2008-07-03 09:14:26 -0500
committerPekka Enberg <penberg@cs.helsinki.fi>2008-07-03 19:01:55 +0300
commit41d54d3bf83f62d3ff5948cb788fe6007e66a0d0 (patch)
tree7aef950af184b3f9b406127415be1f0b52bca8c7 /include
parent481c5346d0981940ee63037eb53e4e37b0735c10 (diff)
slub: Do not use 192 byte sized cache if minimum alignment is 128 byte
The 192 byte cache is not necessary if we have a basic alignment of 128 byte. If it would be used then the 192 would be aligned to the next 128 byte boundary which would result in another 256 byte cache. Two 256 kmalloc caches cause sysfs to complain about a duplicate entry. MIPS needs 128 byte aligned kmalloc caches and spits out warnings on boot without this patch. Signed-off-by: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'include')
-rw-r--r--include/linux/slub_def.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 71e43a12ebbb..cef6f8fddd7d 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -137,10 +137,12 @@ static __always_inline int kmalloc_index(size_t size)
if (size <= KMALLOC_MIN_SIZE)
return KMALLOC_SHIFT_LOW;
+#if KMALLOC_MIN_SIZE <= 64
if (size > 64 && size <= 96)
return 1;
if (size > 128 && size <= 192)
return 2;
+#endif
if (size <= 8) return 3;
if (size <= 16) return 4;
if (size <= 32) return 5;