From 4848ab0f56f7c7bd337754fbc677843a39429145 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Fri, 15 Feb 2008 15:22:22 -0800 Subject: slub: Calculate min_objects based on number of processors. 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 The higher the number of processors the large the order sizes used for various slab caches will become. This has been shown to address the performance issues in hackbench on 16p etc. The calculation is only performed if slub_min_objects is zero (default). If one specifies a slub_min_objects on boot then that setting is taken. Cc: yanmin_zhang@linux.intel.com Signed-off-by: Christoph Lameter --- mm/slub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2008-04-04 13:37:42.000000000 -0700 +++ linux-2.6/mm/slub.c 2008-04-04 13:41:57.000000000 -0700 @@ -1800,7 +1800,7 @@ static struct page *get_object_page(cons */ static int slub_min_order; static int slub_max_order = PAGE_ALLOC_COSTLY_ORDER; -static int slub_min_objects = 4; +static int slub_min_objects = 0; /* * Merge control. If this is set then no merging of slab caches will occur. @@ -1877,6 +1877,8 @@ static inline int calculate_order(int si * 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) {