aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/slab.c39
-rw-r--r--mm/slub.c2
2 files changed, 28 insertions, 13 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 708efe886154..a7f9c244aac6 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -479,11 +479,13 @@ EXPORT_SYMBOL(slab_buffer_size);
479#endif 479#endif
480 480
481/* 481/*
482 * Do not go above this order unless 0 objects fit into the slab. 482 * Do not go above this order unless 0 objects fit into the slab or
483 * overridden on the command line.
483 */ 484 */
484#define BREAK_GFP_ORDER_HI 1 485#define SLAB_MAX_ORDER_HI 1
485#define BREAK_GFP_ORDER_LO 0 486#define SLAB_MAX_ORDER_LO 0
486static int slab_break_gfp_order = BREAK_GFP_ORDER_LO; 487static int slab_max_order = SLAB_MAX_ORDER_LO;
488static bool slab_max_order_set __initdata;
487 489
488/* 490/*
489 * Functions for storing/retrieving the cachep and or slab from the page 491 * Functions for storing/retrieving the cachep and or slab from the page
@@ -851,6 +853,17 @@ static int __init noaliencache_setup(char *s)
851} 853}
852__setup("noaliencache", noaliencache_setup); 854__setup("noaliencache", noaliencache_setup);
853 855
856static int __init slab_max_order_setup(char *str)
857{
858 get_option(&str, &slab_max_order);
859 slab_max_order = slab_max_order < 0 ? 0 :
860 min(slab_max_order, MAX_ORDER - 1);
861 slab_max_order_set = true;
862
863 return 1;
864}
865__setup("slab_max_order=", slab_max_order_setup);
866
854#ifdef CONFIG_NUMA 867#ifdef CONFIG_NUMA
855/* 868/*
856 * Special reaping functions for NUMA systems called from cache_reap(). 869 * Special reaping functions for NUMA systems called from cache_reap().
@@ -1499,10 +1512,11 @@ void __init kmem_cache_init(void)
1499 1512
1500 /* 1513 /*
1501 * Fragmentation resistance on low memory - only use bigger 1514 * Fragmentation resistance on low memory - only use bigger
1502 * page orders on machines with more than 32MB of memory. 1515 * page orders on machines with more than 32MB of memory if
1516 * not overridden on the command line.
1503 */ 1517 */
1504 if (totalram_pages > (32 << 20) >> PAGE_SHIFT) 1518 if (!slab_max_order_set && totalram_pages > (32 << 20) >> PAGE_SHIFT)
1505 slab_break_gfp_order = BREAK_GFP_ORDER_HI; 1519 slab_max_order = SLAB_MAX_ORDER_HI;
1506 1520
1507 /* Bootstrap is tricky, because several objects are allocated 1521 /* Bootstrap is tricky, because several objects are allocated
1508 * from caches that do not exist yet: 1522 * from caches that do not exist yet:
@@ -1927,8 +1941,8 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp)
1927 /* Print header */ 1941 /* Print header */
1928 if (lines == 0) { 1942 if (lines == 0) {
1929 printk(KERN_ERR 1943 printk(KERN_ERR
1930 "Slab corruption: %s start=%p, len=%d\n", 1944 "Slab corruption (%s): %s start=%p, len=%d\n",
1931 cachep->name, realobj, size); 1945 print_tainted(), cachep->name, realobj, size);
1932 print_objinfo(cachep, objp, 0); 1946 print_objinfo(cachep, objp, 0);
1933 } 1947 }
1934 /* Hexdump the affected line */ 1948 /* Hexdump the affected line */
@@ -2112,7 +2126,7 @@ static size_t calculate_slab_order(struct kmem_cache *cachep,
2112 * Large number of objects is good, but very large slabs are 2126 * Large number of objects is good, but very large slabs are
2113 * currently bad for the gfp()s. 2127 * currently bad for the gfp()s.
2114 */ 2128 */
2115 if (gfporder >= slab_break_gfp_order) 2129 if (gfporder >= slab_max_order)
2116 break; 2130 break;
2117 2131
2118 /* 2132 /*
@@ -3037,8 +3051,9 @@ static void check_slabp(struct kmem_cache *cachep, struct slab *slabp)
3037 if (entries != cachep->num - slabp->inuse) { 3051 if (entries != cachep->num - slabp->inuse) {
3038bad: 3052bad:
3039 printk(KERN_ERR "slab: Internal list corruption detected in " 3053 printk(KERN_ERR "slab: Internal list corruption detected in "
3040 "cache '%s'(%d), slabp %p(%d). Hexdump:\n", 3054 "cache '%s'(%d), slabp %p(%d). Tainted(%s). Hexdump:\n",
3041 cachep->name, cachep->num, slabp, slabp->inuse); 3055 cachep->name, cachep->num, slabp, slabp->inuse,
3056 print_tainted());
3042 print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, slabp, 3057 print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, slabp,
3043 sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t), 3058 sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t),
3044 1); 3059 1);
diff --git a/mm/slub.c b/mm/slub.c
index ed3334d9b6da..c3138233a6e8 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -570,7 +570,7 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...)
570 va_end(args); 570 va_end(args);
571 printk(KERN_ERR "========================================" 571 printk(KERN_ERR "========================================"
572 "=====================================\n"); 572 "=====================================\n");
573 printk(KERN_ERR "BUG %s: %s\n", s->name, buf); 573 printk(KERN_ERR "BUG %s (%s): %s\n", s->name, print_tainted(), buf);
574 printk(KERN_ERR "----------------------------------------" 574 printk(KERN_ERR "----------------------------------------"
575 "-------------------------------------\n\n"); 575 "-------------------------------------\n\n");
576} 576}