Commit f9f58285 authored by Fabian Frederick's avatar Fabian Frederick Committed by Linus Torvalds

mm/slub.c: convert printk to pr_foo()

All printk(KERN_foo converted to pr_foo()

Default printk converted to pr_warn()

Coalesce format fragments
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Acked-by: default avatarChristoph Lameter <cl@linux.com>
Cc: Joe Perches <joe@perches.com>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 982792c7
...@@ -403,7 +403,7 @@ static inline bool __cmpxchg_double_slab(struct kmem_cache *s, struct page *page ...@@ -403,7 +403,7 @@ static inline bool __cmpxchg_double_slab(struct kmem_cache *s, struct page *page
stat(s, CMPXCHG_DOUBLE_FAIL); stat(s, CMPXCHG_DOUBLE_FAIL);
#ifdef SLUB_DEBUG_CMPXCHG #ifdef SLUB_DEBUG_CMPXCHG
printk(KERN_INFO "%s %s: cmpxchg double redo ", n, s->name); pr_info("%s %s: cmpxchg double redo ", n, s->name);
#endif #endif
return 0; return 0;
...@@ -444,7 +444,7 @@ static inline bool cmpxchg_double_slab(struct kmem_cache *s, struct page *page, ...@@ -444,7 +444,7 @@ static inline bool cmpxchg_double_slab(struct kmem_cache *s, struct page *page,
stat(s, CMPXCHG_DOUBLE_FAIL); stat(s, CMPXCHG_DOUBLE_FAIL);
#ifdef SLUB_DEBUG_CMPXCHG #ifdef SLUB_DEBUG_CMPXCHG
printk(KERN_INFO "%s %s: cmpxchg double redo ", n, s->name); pr_info("%s %s: cmpxchg double redo ", n, s->name);
#endif #endif
return 0; return 0;
...@@ -546,14 +546,14 @@ static void print_track(const char *s, struct track *t) ...@@ -546,14 +546,14 @@ static void print_track(const char *s, struct track *t)
if (!t->addr) if (!t->addr)
return; return;
printk(KERN_ERR "INFO: %s in %pS age=%lu cpu=%u pid=%d\n", pr_err("INFO: %s in %pS age=%lu cpu=%u pid=%d\n",
s, (void *)t->addr, jiffies - t->when, t->cpu, t->pid); s, (void *)t->addr, jiffies - t->when, t->cpu, t->pid);
#ifdef CONFIG_STACKTRACE #ifdef CONFIG_STACKTRACE
{ {
int i; int i;
for (i = 0; i < TRACK_ADDRS_COUNT; i++) for (i = 0; i < TRACK_ADDRS_COUNT; i++)
if (t->addrs[i]) if (t->addrs[i])
printk(KERN_ERR "\t%pS\n", (void *)t->addrs[i]); pr_err("\t%pS\n", (void *)t->addrs[i]);
else else
break; break;
} }
...@@ -571,8 +571,7 @@ static void print_tracking(struct kmem_cache *s, void *object) ...@@ -571,8 +571,7 @@ static void print_tracking(struct kmem_cache *s, void *object)
static void print_page_info(struct page *page) static void print_page_info(struct page *page)
{ {
printk(KERN_ERR pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=0x%04lx\n",
"INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=0x%04lx\n",
page, page->objects, page->inuse, page->freelist, page->flags); page, page->objects, page->inuse, page->freelist, page->flags);
} }
...@@ -585,11 +584,9 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...) ...@@ -585,11 +584,9 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args); vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args); va_end(args);
printk(KERN_ERR "========================================" pr_err("=============================================================================\n");
"=====================================\n"); pr_err("BUG %s (%s): %s\n", s->name, print_tainted(), buf);
printk(KERN_ERR "BUG %s (%s): %s\n", s->name, print_tainted(), buf); pr_err("-----------------------------------------------------------------------------\n\n");
printk(KERN_ERR "----------------------------------------"
"-------------------------------------\n\n");
add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
} }
...@@ -602,7 +599,7 @@ static void slab_fix(struct kmem_cache *s, char *fmt, ...) ...@@ -602,7 +599,7 @@ static void slab_fix(struct kmem_cache *s, char *fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args); vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args); va_end(args);
printk(KERN_ERR "FIX %s: %s\n", s->name, buf); pr_err("FIX %s: %s\n", s->name, buf);
} }
static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
...@@ -614,7 +611,7 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) ...@@ -614,7 +611,7 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
print_page_info(page); print_page_info(page);
printk(KERN_ERR "INFO: Object 0x%p @offset=%tu fp=0x%p\n\n", pr_err("INFO: Object 0x%p @offset=%tu fp=0x%p\n\n",
p, p - addr, get_freepointer(s, p)); p, p - addr, get_freepointer(s, p));
if (p > addr + 16) if (p > addr + 16)
...@@ -698,7 +695,7 @@ static int check_bytes_and_report(struct kmem_cache *s, struct page *page, ...@@ -698,7 +695,7 @@ static int check_bytes_and_report(struct kmem_cache *s, struct page *page,
end--; end--;
slab_bug(s, "%s overwritten", what); slab_bug(s, "%s overwritten", what);
printk(KERN_ERR "INFO: 0x%p-0x%p. First byte 0x%x instead of 0x%x\n", pr_err("INFO: 0x%p-0x%p. First byte 0x%x instead of 0x%x\n",
fault, end - 1, fault[0], value); fault, end - 1, fault[0], value);
print_trailer(s, page, object); print_trailer(s, page, object);
...@@ -931,7 +928,7 @@ static void trace(struct kmem_cache *s, struct page *page, void *object, ...@@ -931,7 +928,7 @@ static void trace(struct kmem_cache *s, struct page *page, void *object,
int alloc) int alloc)
{ {
if (s->flags & SLAB_TRACE) { if (s->flags & SLAB_TRACE) {
printk(KERN_INFO "TRACE %s %s 0x%p inuse=%d fp=0x%p\n", pr_info("TRACE %s %s 0x%p inuse=%d fp=0x%p\n",
s->name, s->name,
alloc ? "alloc" : "free", alloc ? "alloc" : "free",
object, page->inuse, object, page->inuse,
...@@ -1134,8 +1131,7 @@ static noinline struct kmem_cache_node *free_debug_processing( ...@@ -1134,8 +1131,7 @@ static noinline struct kmem_cache_node *free_debug_processing(
slab_err(s, page, "Attempt to free object(0x%p) " slab_err(s, page, "Attempt to free object(0x%p) "
"outside of slab", object); "outside of slab", object);
} else if (!page->slab_cache) { } else if (!page->slab_cache) {
printk(KERN_ERR pr_err("SLUB <none>: no slab for object 0x%p.\n",
"SLUB <none>: no slab for object 0x%p.\n",
object); object);
dump_stack(); dump_stack();
} else } else
...@@ -1219,8 +1215,8 @@ static int __init setup_slub_debug(char *str) ...@@ -1219,8 +1215,8 @@ static int __init setup_slub_debug(char *str)
slub_debug |= SLAB_FAILSLAB; slub_debug |= SLAB_FAILSLAB;
break; break;
default: default:
printk(KERN_ERR "slub_debug option '%c' " pr_err("slub_debug option '%c' unknown. skipped\n",
"unknown. skipped\n", *str); *str);
} }
} }
...@@ -1770,19 +1766,19 @@ static inline void note_cmpxchg_failure(const char *n, ...@@ -1770,19 +1766,19 @@ static inline void note_cmpxchg_failure(const char *n,
#ifdef SLUB_DEBUG_CMPXCHG #ifdef SLUB_DEBUG_CMPXCHG
unsigned long actual_tid = __this_cpu_read(s->cpu_slab->tid); unsigned long actual_tid = __this_cpu_read(s->cpu_slab->tid);
printk(KERN_INFO "%s %s: cmpxchg redo ", n, s->name); pr_info("%s %s: cmpxchg redo ", n, s->name);
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
if (tid_to_cpu(tid) != tid_to_cpu(actual_tid)) if (tid_to_cpu(tid) != tid_to_cpu(actual_tid))
printk("due to cpu change %d -> %d\n", pr_warn("due to cpu change %d -> %d\n",
tid_to_cpu(tid), tid_to_cpu(actual_tid)); tid_to_cpu(tid), tid_to_cpu(actual_tid));
else else
#endif #endif
if (tid_to_event(tid) != tid_to_event(actual_tid)) if (tid_to_event(tid) != tid_to_event(actual_tid))
printk("due to cpu running other code. Event %ld->%ld\n", pr_warn("due to cpu running other code. Event %ld->%ld\n",
tid_to_event(tid), tid_to_event(actual_tid)); tid_to_event(tid), tid_to_event(actual_tid));
else else
printk("for unknown reason: actual=%lx was=%lx target=%lx\n", pr_warn("for unknown reason: actual=%lx was=%lx target=%lx\n",
actual_tid, tid, next_tid(tid)); actual_tid, tid, next_tid(tid));
#endif #endif
stat(s, CMPXCHG_DOUBLE_CPU_FAIL); stat(s, CMPXCHG_DOUBLE_CPU_FAIL);
...@@ -2154,16 +2150,15 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid) ...@@ -2154,16 +2150,15 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
{ {
int node; int node;
printk(KERN_WARNING pr_warn("SLUB: Unable to allocate memory on node %d (gfp=0x%x)\n",
"SLUB: Unable to allocate memory on node %d (gfp=0x%x)\n",
nid, gfpflags); nid, gfpflags);
printk(KERN_WARNING " cache: %s, object size: %d, buffer size: %d, " pr_warn(" cache: %s, object size: %d, buffer size: %d, default order: %d, min order: %d\n",
"default order: %d, min order: %d\n", s->name, s->object_size, s->name, s->object_size, s->size, oo_order(s->oo),
s->size, oo_order(s->oo), oo_order(s->min)); oo_order(s->min));
if (oo_order(s->min) > get_order(s->object_size)) if (oo_order(s->min) > get_order(s->object_size))
printk(KERN_WARNING " %s debugging increased min order, use " pr_warn(" %s debugging increased min order, use slub_debug=O to disable.\n",
"slub_debug=O to disable.\n", s->name); s->name);
for_each_online_node(node) { for_each_online_node(node) {
struct kmem_cache_node *n = get_node(s, node); struct kmem_cache_node *n = get_node(s, node);
...@@ -2178,8 +2173,7 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid) ...@@ -2178,8 +2173,7 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
nr_slabs = node_nr_slabs(n); nr_slabs = node_nr_slabs(n);
nr_objs = node_nr_objs(n); nr_objs = node_nr_objs(n);
printk(KERN_WARNING pr_warn(" node %d: slabs: %ld, objs: %ld, free: %ld\n",
" node %d: slabs: %ld, objs: %ld, free: %ld\n",
node, nr_slabs, nr_objs, nr_free); node, nr_slabs, nr_objs, nr_free);
} }
} }
...@@ -2894,10 +2888,8 @@ static void early_kmem_cache_node_alloc(int node) ...@@ -2894,10 +2888,8 @@ static void early_kmem_cache_node_alloc(int node)
BUG_ON(!page); BUG_ON(!page);
if (page_to_nid(page) != node) { if (page_to_nid(page) != node) {
printk(KERN_ERR "SLUB: Unable to allocate memory from " pr_err("SLUB: Unable to allocate memory from node %d\n", node);
"node %d\n", node); pr_err("SLUB: Allocating a useless per node structure in order to be able to continue\n");
printk(KERN_ERR "SLUB: Allocating a useless per node structure "
"in order to be able to continue\n");
} }
n = page->freelist; n = page->freelist;
...@@ -3182,8 +3174,7 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page, ...@@ -3182,8 +3174,7 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
for_each_object(p, s, addr, page->objects) { for_each_object(p, s, addr, page->objects) {
if (!test_bit(slab_index(p, s, addr), map)) { if (!test_bit(slab_index(p, s, addr), map)) {
printk(KERN_ERR "INFO: Object 0x%p @offset=%tu\n", pr_err("INFO: Object 0x%p @offset=%tu\n", p, p - addr);
p, p - addr);
print_tracking(s, p); print_tracking(s, p);
} }
} }
...@@ -3650,9 +3641,7 @@ void __init kmem_cache_init(void) ...@@ -3650,9 +3641,7 @@ void __init kmem_cache_init(void)
register_cpu_notifier(&slab_notifier); register_cpu_notifier(&slab_notifier);
#endif #endif
printk(KERN_INFO pr_info("SLUB: HWalign=%d, Order=%d-%d, MinObjects=%d, CPUs=%d, Nodes=%d\n",
"SLUB: HWalign=%d, Order=%d-%d, MinObjects=%d,"
" CPUs=%d, Nodes=%d\n",
cache_line_size(), cache_line_size(),
slub_min_order, slub_max_order, slub_min_objects, slub_min_order, slub_max_order, slub_min_objects,
nr_cpu_ids, nr_node_ids); nr_cpu_ids, nr_node_ids);
...@@ -3934,8 +3923,8 @@ static int validate_slab_node(struct kmem_cache *s, ...@@ -3934,8 +3923,8 @@ static int validate_slab_node(struct kmem_cache *s,
count++; count++;
} }
if (count != n->nr_partial) if (count != n->nr_partial)
printk(KERN_ERR "SLUB %s: %ld partial slabs counted but " pr_err("SLUB %s: %ld partial slabs counted but counter=%ld\n",
"counter=%ld\n", s->name, count, n->nr_partial); s->name, count, n->nr_partial);
if (!(s->flags & SLAB_STORE_USER)) if (!(s->flags & SLAB_STORE_USER))
goto out; goto out;
...@@ -3945,9 +3934,8 @@ static int validate_slab_node(struct kmem_cache *s, ...@@ -3945,9 +3934,8 @@ static int validate_slab_node(struct kmem_cache *s,
count++; count++;
} }
if (count != atomic_long_read(&n->nr_slabs)) if (count != atomic_long_read(&n->nr_slabs))
printk(KERN_ERR "SLUB: %s %ld slabs counted but " pr_err("SLUB: %s %ld slabs counted but counter=%ld\n",
"counter=%ld\n", s->name, count, s->name, count, atomic_long_read(&n->nr_slabs));
atomic_long_read(&n->nr_slabs));
out: out:
spin_unlock_irqrestore(&n->list_lock, flags); spin_unlock_irqrestore(&n->list_lock, flags);
...@@ -4211,53 +4199,50 @@ static void resiliency_test(void) ...@@ -4211,53 +4199,50 @@ static void resiliency_test(void)
BUILD_BUG_ON(KMALLOC_MIN_SIZE > 16 || KMALLOC_SHIFT_HIGH < 10); BUILD_BUG_ON(KMALLOC_MIN_SIZE > 16 || KMALLOC_SHIFT_HIGH < 10);
printk(KERN_ERR "SLUB resiliency testing\n"); pr_err("SLUB resiliency testing\n");
printk(KERN_ERR "-----------------------\n"); pr_err("-----------------------\n");
printk(KERN_ERR "A. Corruption after allocation\n"); pr_err("A. Corruption after allocation\n");
p = kzalloc(16, GFP_KERNEL); p = kzalloc(16, GFP_KERNEL);
p[16] = 0x12; p[16] = 0x12;
printk(KERN_ERR "\n1. kmalloc-16: Clobber Redzone/next pointer" pr_err("\n1. kmalloc-16: Clobber Redzone/next pointer 0x12->0x%p\n\n",
" 0x12->0x%p\n\n", p + 16); p + 16);
validate_slab_cache(kmalloc_caches[4]); validate_slab_cache(kmalloc_caches[4]);
/* Hmmm... The next two are dangerous */ /* Hmmm... The next two are dangerous */
p = kzalloc(32, GFP_KERNEL); p = kzalloc(32, GFP_KERNEL);
p[32 + sizeof(void *)] = 0x34; p[32 + sizeof(void *)] = 0x34;
printk(KERN_ERR "\n2. kmalloc-32: Clobber next pointer/next slab" pr_err("\n2. kmalloc-32: Clobber next pointer/next slab 0x34 -> -0x%p\n",
" 0x34 -> -0x%p\n", p); p);
printk(KERN_ERR pr_err("If allocated object is overwritten then not detectable\n\n");
"If allocated object is overwritten then not detectable\n\n");
validate_slab_cache(kmalloc_caches[5]); validate_slab_cache(kmalloc_caches[5]);
p = kzalloc(64, GFP_KERNEL); p = kzalloc(64, GFP_KERNEL);
p += 64 + (get_cycles() & 0xff) * sizeof(void *); p += 64 + (get_cycles() & 0xff) * sizeof(void *);
*p = 0x56; *p = 0x56;
printk(KERN_ERR "\n3. kmalloc-64: corrupting random byte 0x56->0x%p\n", pr_err("\n3. kmalloc-64: corrupting random byte 0x56->0x%p\n",
p); p);
printk(KERN_ERR pr_err("If allocated object is overwritten then not detectable\n\n");
"If allocated object is overwritten then not detectable\n\n");
validate_slab_cache(kmalloc_caches[6]); validate_slab_cache(kmalloc_caches[6]);
printk(KERN_ERR "\nB. Corruption after free\n"); pr_err("\nB. Corruption after free\n");
p = kzalloc(128, GFP_KERNEL); p = kzalloc(128, GFP_KERNEL);
kfree(p); kfree(p);
*p = 0x78; *p = 0x78;
printk(KERN_ERR "1. kmalloc-128: Clobber first word 0x78->0x%p\n\n", p); pr_err("1. kmalloc-128: Clobber first word 0x78->0x%p\n\n", p);
validate_slab_cache(kmalloc_caches[7]); validate_slab_cache(kmalloc_caches[7]);
p = kzalloc(256, GFP_KERNEL); p = kzalloc(256, GFP_KERNEL);
kfree(p); kfree(p);
p[50] = 0x9a; p[50] = 0x9a;
printk(KERN_ERR "\n2. kmalloc-256: Clobber 50th byte 0x9a->0x%p\n\n", pr_err("\n2. kmalloc-256: Clobber 50th byte 0x9a->0x%p\n\n", p);
p);
validate_slab_cache(kmalloc_caches[8]); validate_slab_cache(kmalloc_caches[8]);
p = kzalloc(512, GFP_KERNEL); p = kzalloc(512, GFP_KERNEL);
kfree(p); kfree(p);
p[512] = 0xab; p[512] = 0xab;
printk(KERN_ERR "\n3. kmalloc-512: Clobber redzone 0xab->0x%p\n\n", p); pr_err("\n3. kmalloc-512: Clobber redzone 0xab->0x%p\n\n", p);
validate_slab_cache(kmalloc_caches[9]); validate_slab_cache(kmalloc_caches[9]);
} }
#else #else
...@@ -5303,7 +5288,7 @@ static int __init slab_sysfs_init(void) ...@@ -5303,7 +5288,7 @@ static int __init slab_sysfs_init(void)
slab_kset = kset_create_and_add("slab", &slab_uevent_ops, kernel_kobj); slab_kset = kset_create_and_add("slab", &slab_uevent_ops, kernel_kobj);
if (!slab_kset) { if (!slab_kset) {
mutex_unlock(&slab_mutex); mutex_unlock(&slab_mutex);
printk(KERN_ERR "Cannot register slab subsystem.\n"); pr_err("Cannot register slab subsystem.\n");
return -ENOSYS; return -ENOSYS;
} }
...@@ -5312,8 +5297,8 @@ static int __init slab_sysfs_init(void) ...@@ -5312,8 +5297,8 @@ static int __init slab_sysfs_init(void)
list_for_each_entry(s, &slab_caches, list) { list_for_each_entry(s, &slab_caches, list) {
err = sysfs_slab_add(s); err = sysfs_slab_add(s);
if (err) if (err)
printk(KERN_ERR "SLUB: Unable to add boot slab %s" pr_err("SLUB: Unable to add boot slab %s to sysfs\n",
" to sysfs\n", s->name); s->name);
} }
while (alias_list) { while (alias_list) {
...@@ -5322,8 +5307,8 @@ static int __init slab_sysfs_init(void) ...@@ -5322,8 +5307,8 @@ static int __init slab_sysfs_init(void)
alias_list = alias_list->next; alias_list = alias_list->next;
err = sysfs_slab_alias(al->s, al->name); err = sysfs_slab_alias(al->s, al->name);
if (err) if (err)
printk(KERN_ERR "SLUB: Unable to add boot slab alias" pr_err("SLUB: Unable to add boot slab alias %s to sysfs\n",
" %s to sysfs\n", al->name); al->name);
kfree(al); kfree(al);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment