aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux-foundation.org>2009-02-17 12:05:07 -0500
committerPekka Enberg <penberg@cs.helsinki.fi>2009-02-20 05:28:36 -0500
commitfe1200b63d158b28eef6d4de1e5b5f99c681ba2f (patch)
treebff176ef50efbc161e240ec4295a6da815eae997 /mm
parentb578f3fcca1e78624dfb5f358776e63711d7fda2 (diff)
SLUB: Introduce and use SLUB_MAX_SIZE and SLUB_PAGE_SHIFT constants
As a preparational patch to bump up page allocator pass-through threshold, introduce two new constants SLUB_MAX_SIZE and SLUB_PAGE_SHIFT and convert mm/slub.c to use them. Reported-by: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> Tested-by: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> Signed-off-by: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm')
-rw-r--r--mm/slub.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/slub.c b/mm/slub.c
index bdc9abb08a23..5a5e7f5bf799 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2475,7 +2475,7 @@ EXPORT_SYMBOL(kmem_cache_destroy);
2475 * Kmalloc subsystem 2475 * Kmalloc subsystem
2476 *******************************************************************/ 2476 *******************************************************************/
2477 2477
2478struct kmem_cache kmalloc_caches[PAGE_SHIFT + 1] __cacheline_aligned; 2478struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT] __cacheline_aligned;
2479EXPORT_SYMBOL(kmalloc_caches); 2479EXPORT_SYMBOL(kmalloc_caches);
2480 2480
2481static int __init setup_slub_min_order(char *str) 2481static int __init setup_slub_min_order(char *str)
@@ -2537,7 +2537,7 @@ panic:
2537} 2537}
2538 2538
2539#ifdef CONFIG_ZONE_DMA 2539#ifdef CONFIG_ZONE_DMA
2540static struct kmem_cache *kmalloc_caches_dma[PAGE_SHIFT + 1]; 2540static struct kmem_cache *kmalloc_caches_dma[SLUB_PAGE_SHIFT];
2541 2541
2542static void sysfs_add_func(struct work_struct *w) 2542static void sysfs_add_func(struct work_struct *w)
2543{ 2543{
@@ -2658,7 +2658,7 @@ void *__kmalloc(size_t size, gfp_t flags)
2658{ 2658{
2659 struct kmem_cache *s; 2659 struct kmem_cache *s;
2660 2660
2661 if (unlikely(size > PAGE_SIZE)) 2661 if (unlikely(size > SLUB_MAX_SIZE))
2662 return kmalloc_large(size, flags); 2662 return kmalloc_large(size, flags);
2663 2663
2664 s = get_slab(size, flags); 2664 s = get_slab(size, flags);
@@ -2686,7 +2686,7 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
2686{ 2686{
2687 struct kmem_cache *s; 2687 struct kmem_cache *s;
2688 2688
2689 if (unlikely(size > PAGE_SIZE)) 2689 if (unlikely(size > SLUB_MAX_SIZE))
2690 return kmalloc_large_node(size, flags, node); 2690 return kmalloc_large_node(size, flags, node);
2691 2691
2692 s = get_slab(size, flags); 2692 s = get_slab(size, flags);
@@ -2985,7 +2985,7 @@ void __init kmem_cache_init(void)
2985 caches++; 2985 caches++;
2986 } 2986 }
2987 2987
2988 for (i = KMALLOC_SHIFT_LOW; i <= PAGE_SHIFT; i++) { 2988 for (i = KMALLOC_SHIFT_LOW; i < SLUB_PAGE_SHIFT; i++) {
2989 create_kmalloc_cache(&kmalloc_caches[i], 2989 create_kmalloc_cache(&kmalloc_caches[i],
2990 "kmalloc", 1 << i, GFP_KERNEL); 2990 "kmalloc", 1 << i, GFP_KERNEL);
2991 caches++; 2991 caches++;
@@ -3022,7 +3022,7 @@ void __init kmem_cache_init(void)
3022 slab_state = UP; 3022 slab_state = UP;
3023 3023
3024 /* Provide the correct kmalloc names now that the caches are up */ 3024 /* Provide the correct kmalloc names now that the caches are up */
3025 for (i = KMALLOC_SHIFT_LOW; i <= PAGE_SHIFT; i++) 3025 for (i = KMALLOC_SHIFT_LOW; i < SLUB_PAGE_SHIFT; i++)
3026 kmalloc_caches[i]. name = 3026 kmalloc_caches[i]. name =
3027 kasprintf(GFP_KERNEL, "kmalloc-%d", 1 << i); 3027 kasprintf(GFP_KERNEL, "kmalloc-%d", 1 << i);
3028 3028
@@ -3222,7 +3222,7 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller)
3222{ 3222{
3223 struct kmem_cache *s; 3223 struct kmem_cache *s;
3224 3224
3225 if (unlikely(size > PAGE_SIZE)) 3225 if (unlikely(size > SLUB_MAX_SIZE))
3226 return kmalloc_large(size, gfpflags); 3226 return kmalloc_large(size, gfpflags);
3227 3227
3228 s = get_slab(size, gfpflags); 3228 s = get_slab(size, gfpflags);
@@ -3238,7 +3238,7 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
3238{ 3238{
3239 struct kmem_cache *s; 3239 struct kmem_cache *s;
3240 3240
3241 if (unlikely(size > PAGE_SIZE)) 3241 if (unlikely(size > SLUB_MAX_SIZE))
3242 return kmalloc_large_node(size, gfpflags, node); 3242 return kmalloc_large_node(size, gfpflags, node);
3243 3243
3244 s = get_slab(size, gfpflags); 3244 s = get_slab(size, gfpflags);