aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorZhang Yanmin <yanmin.zhang@linux.intel.com>2009-02-12 11:00:17 -0500
committerPekka Enberg <penberg@cs.helsinki.fi>2009-02-20 05:26:12 -0500
commite8120ff1ffc51102ead1f4c98a3fd5d26fefc722 (patch)
tree3cdadf0dc36df4a34f5ef30a788ef62d3a601de8 /mm/slub.c
parent51735a7ca67531267a27b57e5fe20f7815192f9c (diff)
SLUB: Fix default slab order for big object sizes
The default order of kmalloc-8192 on 2*4 stoakley is an issue of calculate_order. slab_size order name ------------------------------------------------- 4096 3 sgpool-128 8192 2 kmalloc-8192 16384 3 kmalloc-16384 kmalloc-8192's default order is smaller than sgpool-128's. On 4*4 tigerton machine, a similiar issue appears on another kmem_cache. Function calculate_order uses 'min_objects /= 2;' to shrink. Plus size calculation/checking in slab_order, sometimes above issue appear. Below patch against 2.6.29-rc2 fixes it. I checked the default orders of all kmem_cache and they don't become smaller than before. So the patch wouldn't hurt performance. Signed-off-by Zhang Yanmin <yanmin.zhang@linux.intel.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 5a5e7f5bf799..c01a7a3001d2 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1844,6 +1844,7 @@ static inline int calculate_order(int size)
1844 int order; 1844 int order;
1845 int min_objects; 1845 int min_objects;
1846 int fraction; 1846 int fraction;
1847 int max_objects;
1847 1848
1848 /* 1849 /*
1849 * Attempt to find best configuration for a slab. This 1850 * Attempt to find best configuration for a slab. This
@@ -1856,6 +1857,9 @@ static inline int calculate_order(int size)
1856 min_objects = slub_min_objects; 1857 min_objects = slub_min_objects;
1857 if (!min_objects) 1858 if (!min_objects)
1858 min_objects = 4 * (fls(nr_cpu_ids) + 1); 1859 min_objects = 4 * (fls(nr_cpu_ids) + 1);
1860 max_objects = (PAGE_SIZE << slub_max_order)/size;
1861 min_objects = min(min_objects, max_objects);
1862
1859 while (min_objects > 1) { 1863 while (min_objects > 1) {
1860 fraction = 16; 1864 fraction = 16;
1861 while (fraction >= 4) { 1865 while (fraction >= 4) {
@@ -1865,7 +1869,7 @@ static inline int calculate_order(int size)
1865 return order; 1869 return order;
1866 fraction /= 2; 1870 fraction /= 2;
1867 } 1871 }
1868 min_objects /= 2; 1872 min_objects --;
1869 } 1873 }
1870 1874
1871 /* 1875 /*