Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6:
slub: Do not use 192 byte sized cache if minimum alignment is 128 byte

+12 -2
+2
include/linux/slub_def.h
··· 137 137 if (size <= KMALLOC_MIN_SIZE) 138 138 return KMALLOC_SHIFT_LOW; 139 139 140 + #if KMALLOC_MIN_SIZE <= 64 140 141 if (size > 64 && size <= 96) 141 142 return 1; 142 143 if (size > 128 && size <= 192) 143 144 return 2; 145 + #endif 144 146 if (size <= 8) return 3; 145 147 if (size <= 16) return 4; 146 148 if (size <= 32) return 5;
+10 -2
mm/slub.c
··· 2995 2995 create_kmalloc_cache(&kmalloc_caches[1], 2996 2996 "kmalloc-96", 96, GFP_KERNEL); 2997 2997 caches++; 2998 - } 2999 - if (KMALLOC_MIN_SIZE <= 128) { 3000 2998 create_kmalloc_cache(&kmalloc_caches[2], 3001 2999 "kmalloc-192", 192, GFP_KERNEL); 3002 3000 caches++; ··· 3023 3025 3024 3026 for (i = 8; i < KMALLOC_MIN_SIZE; i += 8) 3025 3027 size_index[(i - 1) / 8] = KMALLOC_SHIFT_LOW; 3028 + 3029 + if (KMALLOC_MIN_SIZE == 128) { 3030 + /* 3031 + * The 192 byte sized cache is not used if the alignment 3032 + * is 128 byte. Redirect kmalloc to use the 256 byte cache 3033 + * instead. 3034 + */ 3035 + for (i = 128 + 8; i <= 192; i += 8) 3036 + size_index[(i - 1) / 8] = 8; 3037 + } 3026 3038 3027 3039 slab_state = UP; 3028 3040