From 9243ed5394912d94c8094a39d04ff74e49981814 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Fri, 15 Feb 2008 15:22:22 -0800 Subject: [PATCH] slub: Adjust order boundaries and minimum objects per slab. Since there is now no worry anymore about higher order allocs (hopefully). Set the max order to default to PAGE_ALLOC_ORDER_COSTLY (32k) and require slub to use a higher order if a certain object density cannot be reached. The mininum objects per slab is calculated based on the number of processors that may come online. Processors min_objects --------------------------- 1 4 2 8 4 12 8 16 16 20 32 24 64 28 1024 44 4096 52 V1->V2 - Add logic to compute min_objects based on processor count. - Dump the DEFAULT_xx constants. Signed-off-by: Christoph Lameter --- mm/slub.c | 31 +++++++------------------------ 1 files changed, 7 insertions(+), 24 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index fcaea5e..a87f3c5 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5,7 +5,7 @@ * The allocator synchronizes using per slab locks and only * uses a centralized lock to manage a pool of partial slabs. * - * (C) 2007 SGI, Christoph Lameter + * (C) 2007, 2008 SGI, Christoph Lameter */ #include @@ -149,25 +149,6 @@ static inline void ClearSlabDebug(struct page *page) /* Enable to test recovery from slab corruption on boot */ #undef SLUB_RESILIENCY_TEST -#if PAGE_SHIFT <= 12 - -/* - * Small page size. Make sure that we do not fragment memory - */ -#define DEFAULT_MAX_ORDER 1 -#define DEFAULT_MIN_OBJECTS 4 - -#else - -/* - * Large page machines are customarily able to handle larger - * page orders. - */ -#define DEFAULT_MAX_ORDER 2 -#define DEFAULT_MIN_OBJECTS 8 - -#endif - /* * Mininum number of partial slabs. These will be left on the partial * lists even if they are empty. kmem_cache_shrink may reclaim them. @@ -1787,8 +1768,8 @@ static struct page *get_object_page(const void *x) * take the list_lock. */ static int slub_min_order; -static int slub_max_order = DEFAULT_MAX_ORDER; -static int slub_min_objects = DEFAULT_MIN_OBJECTS; +static int slub_max_order = PAGE_ALLOC_COSTLY_ORDER; +static int slub_min_objects = 0; /* * Merge control. If this is set then no merging of slab caches will occur. @@ -1865,9 +1846,11 @@ static inline int calculate_order(int size) * we reduce the minimum objects required in a slab. */ min_objects = slub_min_objects; + if (!min_objects) + min_objects = 4 * fls(nr_cpu_ids); while (min_objects > 1) { - fraction = 8; - while (fraction >= 4) { + fraction = 16; + while (fraction >= 8) { order = slab_order(size, min_objects, slub_max_order, fraction); if (order <= slub_max_order) -- 1.5.4.4