diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-05-17 01:11:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-17 08:23:04 -0400 |
commit | 0aa817f078b655d0ae36669169d73a5c8a388016 (patch) | |
tree | 140acc4d0dc992b4d20394f6a6412a7c1bb3a306 /include/linux/kmalloc_sizes.h | |
parent | 3ec0974210fe1b7c0618ad6e39a882a4237d7de2 (diff) |
Slab allocators: define common size limitations
Currently we have a maze of configuration variables that determine the
maximum slab size. Worst of all it seems to vary between SLAB and SLUB.
So define a common maximum size for kmalloc. For conveniences sake we use
the maximum size ever supported which is 32 MB. We limit the maximum size
to a lower limit if MAX_ORDER does not allow such large allocations.
For many architectures this patch will have the effect of adding large
kmalloc sizes. x86_64 adds 5 new kmalloc sizes. So a small amount of
memory will be needed for these caches (contemporary SLAB has dynamically
sizeable node and cpu structure so the waste is less than in the past)
Most architectures will then be able to allocate object with sizes up to
MAX_ORDER. We have had repeated breakage (in fact whenever we doubled the
number of supported processors) on IA64 because one or the other struct
grew beyond what the slab allocators supported. This will avoid future
issues and f.e. avoid fixes for 2k and 4k cpu support.
CONFIG_LARGE_ALLOCS is no longer necessary so drop it.
It fixes sparc64 with SLAB.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kmalloc_sizes.h')
-rw-r--r-- | include/linux/kmalloc_sizes.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/include/linux/kmalloc_sizes.h b/include/linux/kmalloc_sizes.h index bda23e00ed71..e576b848ce10 100644 --- a/include/linux/kmalloc_sizes.h +++ b/include/linux/kmalloc_sizes.h | |||
@@ -19,17 +19,27 @@ | |||
19 | CACHE(32768) | 19 | CACHE(32768) |
20 | CACHE(65536) | 20 | CACHE(65536) |
21 | CACHE(131072) | 21 | CACHE(131072) |
22 | #if (NR_CPUS > 512) || (MAX_NUMNODES > 256) || !defined(CONFIG_MMU) | 22 | #if KMALLOC_MAX_SIZE >= 262144 |
23 | CACHE(262144) | 23 | CACHE(262144) |
24 | #endif | 24 | #endif |
25 | #ifndef CONFIG_MMU | 25 | #if KMALLOC_MAX_SIZE >= 524288 |
26 | CACHE(524288) | 26 | CACHE(524288) |
27 | #endif | ||
28 | #if KMALLOC_MAX_SIZE >= 1048576 | ||
27 | CACHE(1048576) | 29 | CACHE(1048576) |
28 | #ifdef CONFIG_LARGE_ALLOCS | 30 | #endif |
31 | #if KMALLOC_MAX_SIZE >= 2097152 | ||
29 | CACHE(2097152) | 32 | CACHE(2097152) |
33 | #endif | ||
34 | #if KMALLOC_MAX_SIZE >= 4194304 | ||
30 | CACHE(4194304) | 35 | CACHE(4194304) |
36 | #endif | ||
37 | #if KMALLOC_MAX_SIZE >= 8388608 | ||
31 | CACHE(8388608) | 38 | CACHE(8388608) |
39 | #endif | ||
40 | #if KMALLOC_MAX_SIZE >= 16777216 | ||
32 | CACHE(16777216) | 41 | CACHE(16777216) |
42 | #endif | ||
43 | #if KMALLOC_MAX_SIZE >= 33554432 | ||
33 | CACHE(33554432) | 44 | CACHE(33554432) |
34 | #endif /* CONFIG_LARGE_ALLOCS */ | 45 | #endif |
35 | #endif /* CONFIG_MMU */ | ||