--- include/linux/slub_def.h | 3 +-- mm/slub.c | 30 +++++++++--------------------- 2 files changed, 10 insertions(+), 23 deletions(-) Index: linux-2.6/include/linux/slub_def.h =================================================================== --- linux-2.6.orig/include/linux/slub_def.h 2008-02-16 00:08:08.000000000 -0800 +++ linux-2.6/include/linux/slub_def.h 2008-02-16 00:08:49.000000000 -0800 @@ -105,7 +105,7 @@ struct kmem_cache { #if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8 #define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN #else -#define KMALLOC_MIN_SIZE 8 +#define KMALLOC_MIN_SIZE 16 #endif #define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) @@ -132,7 +132,6 @@ static __always_inline int kmalloc_index return 1; if (size > 128 && size <= 192) return 2; - if (size <= 8) return 3; if (size <= 16) return 4; if (size <= 32) return 5; if (size <= 64) return 6; Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2008-02-16 00:07:56.000000000 -0800 +++ linux-2.6/mm/slub.c 2008-02-16 00:27:37.000000000 -0800 @@ -1171,6 +1171,10 @@ static void __free_slab(struct kmem_cach NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE, -pages); + reset_page_mapcount(page); + if (PageCompound(page)) + /* mapcount of page + 1 was used for the object count */ + reset_page_mapcount(page + 1); page->mapping = NULL; __free_pages(page, s->order); } @@ -1202,10 +1206,6 @@ static void discard_slab(struct kmem_cac atomic_long_dec(&n->nr_slabs); atomic_long_sub(slab_objects(s, page), &n->total_objects); - reset_page_mapcount(page); - if (PageCompound(page)) - /* mapcount of page + 1 was used for the object count */ - reset_page_mapcount(page + 1); __ClearPageSlab(page); free_slab(s, page); } @@ -2624,35 +2624,23 @@ out: #endif /* - * Conversion table for small slabs sizes / 8 to the index in the + * Conversion table for small slabs sizes / 16 to the index in the * kmalloc array. This is necessary for slabs < 192 since we have non power * of two cache sizes there. The size of larger slabs can be determined using * fls. */ -static s8 size_index[24] = { - 3, /* 8 */ +static s8 size_index[12] = { 4, /* 16 */ - 5, /* 24 */ 5, /* 32 */ - 6, /* 40 */ 6, /* 48 */ - 6, /* 56 */ 6, /* 64 */ - 1, /* 72 */ 1, /* 80 */ - 1, /* 88 */ 1, /* 96 */ - 7, /* 104 */ 7, /* 112 */ - 7, /* 120 */ 7, /* 128 */ - 2, /* 136 */ 2, /* 144 */ - 2, /* 152 */ 2, /* 160 */ - 2, /* 168 */ 2, /* 176 */ - 2, /* 184 */ 2 /* 192 */ }; @@ -2664,7 +2652,7 @@ static struct kmem_cache *get_slab(size_ if (!size) return ZERO_SIZE_PTR; - index = size_index[(size - 1) / 8]; + index = size_index[(size - 1) / 16]; } else index = fls(size - 1); @@ -3056,8 +3044,8 @@ void __init kmem_cache_init(void) BUILD_BUG_ON(KMALLOC_MIN_SIZE > 256 || (KMALLOC_MIN_SIZE & (KMALLOC_MIN_SIZE - 1))); - for (i = 8; i < KMALLOC_MIN_SIZE; i += 8) - size_index[(i - 1) / 8] = KMALLOC_SHIFT_LOW; + for (i = 16; i < KMALLOC_MIN_SIZE; i += 16) + size_index[(i - 1) / 16] = KMALLOC_SHIFT_LOW; slab_state = UP;