mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 17:01:14 +00:00
![Christoph Lameter](/assets/img/avatar_default.png)
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>
45 lines
724 B
C
45 lines
724 B
C
#if (PAGE_SIZE == 4096)
|
|
CACHE(32)
|
|
#endif
|
|
CACHE(64)
|
|
#if L1_CACHE_BYTES < 64
|
|
CACHE(96)
|
|
#endif
|
|
CACHE(128)
|
|
#if L1_CACHE_BYTES < 128
|
|
CACHE(192)
|
|
#endif
|
|
CACHE(256)
|
|
CACHE(512)
|
|
CACHE(1024)
|
|
CACHE(2048)
|
|
CACHE(4096)
|
|
CACHE(8192)
|
|
CACHE(16384)
|
|
CACHE(32768)
|
|
CACHE(65536)
|
|
CACHE(131072)
|
|
#if KMALLOC_MAX_SIZE >= 262144
|
|
CACHE(262144)
|
|
#endif
|
|
#if KMALLOC_MAX_SIZE >= 524288
|
|
CACHE(524288)
|
|
#endif
|
|
#if KMALLOC_MAX_SIZE >= 1048576
|
|
CACHE(1048576)
|
|
#endif
|
|
#if KMALLOC_MAX_SIZE >= 2097152
|
|
CACHE(2097152)
|
|
#endif
|
|
#if KMALLOC_MAX_SIZE >= 4194304
|
|
CACHE(4194304)
|
|
#endif
|
|
#if KMALLOC_MAX_SIZE >= 8388608
|
|
CACHE(8388608)
|
|
#endif
|
|
#if KMALLOC_MAX_SIZE >= 16777216
|
|
CACHE(16777216)
|
|
#endif
|
|
#if KMALLOC_MAX_SIZE >= 33554432
|
|
CACHE(33554432)
|
|
#endif
|