Commit 663997d4 authored by Joe Perches's avatar Joe Perches Committed by Ingo Molnar

sched: Use pr_fmt() and pr_<level>()

- Convert printk(KERN_<level> to pr_<level> (not KERN_DEBUG)
 - Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 - Coalesce long format strings
 - Add missing \n to "ERROR: !SD_LOAD_BALANCE domain has parent"
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1260655047.2637.7.camel@Joe-Laptop.home>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7539a3b3
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
* Thomas Gleixner, Mike Kravetz * Thomas Gleixner, Mike Kravetz
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/nmi.h> #include <linux/nmi.h>
...@@ -5337,8 +5339,8 @@ static noinline void __schedule_bug(struct task_struct *prev) ...@@ -5337,8 +5339,8 @@ static noinline void __schedule_bug(struct task_struct *prev)
{ {
struct pt_regs *regs = get_irq_regs(); struct pt_regs *regs = get_irq_regs();
printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n", pr_err("BUG: scheduling while atomic: %s/%d/0x%08x\n",
prev->comm, prev->pid, preempt_count()); prev->comm, prev->pid, preempt_count());
debug_show_held_locks(prev); debug_show_held_locks(prev);
print_modules(); print_modules();
...@@ -6906,23 +6908,23 @@ void sched_show_task(struct task_struct *p) ...@@ -6906,23 +6908,23 @@ void sched_show_task(struct task_struct *p)
unsigned state; unsigned state;
state = p->state ? __ffs(p->state) + 1 : 0; state = p->state ? __ffs(p->state) + 1 : 0;
printk(KERN_INFO "%-13.13s %c", p->comm, pr_info("%-13.13s %c", p->comm,
state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?'); state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
if (state == TASK_RUNNING) if (state == TASK_RUNNING)
printk(KERN_CONT " running "); pr_cont(" running ");
else else
printk(KERN_CONT " %08lx ", thread_saved_pc(p)); pr_cont(" %08lx ", thread_saved_pc(p));
#else #else
if (state == TASK_RUNNING) if (state == TASK_RUNNING)
printk(KERN_CONT " running task "); pr_cont(" running task ");
else else
printk(KERN_CONT " %016lx ", thread_saved_pc(p)); pr_cont(" %016lx ", thread_saved_pc(p));
#endif #endif
#ifdef CONFIG_DEBUG_STACK_USAGE #ifdef CONFIG_DEBUG_STACK_USAGE
free = stack_not_used(p); free = stack_not_used(p);
#endif #endif
printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free, pr_cont("%5lu %5d %6d 0x%08lx\n", free,
task_pid_nr(p), task_pid_nr(p->real_parent), task_pid_nr(p), task_pid_nr(p->real_parent),
(unsigned long)task_thread_info(p)->flags); (unsigned long)task_thread_info(p)->flags);
...@@ -6934,11 +6936,9 @@ void show_state_filter(unsigned long state_filter) ...@@ -6934,11 +6936,9 @@ void show_state_filter(unsigned long state_filter)
struct task_struct *g, *p; struct task_struct *g, *p;
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
printk(KERN_INFO pr_info(" task PC stack pid father\n");
" task PC stack pid father\n");
#else #else
printk(KERN_INFO pr_info(" task PC stack pid father\n");
" task PC stack pid father\n");
#endif #endif
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
do_each_thread(g, p) { do_each_thread(g, p) {
...@@ -7296,9 +7296,8 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) ...@@ -7296,9 +7296,8 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
* leave kernel. * leave kernel.
*/ */
if (p->mm && printk_ratelimit()) { if (p->mm && printk_ratelimit()) {
printk(KERN_INFO "process %d (%s) no " pr_info("process %d (%s) no longer affine to cpu%d\n",
"longer affine to cpu%d\n", task_pid_nr(p), p->comm, dead_cpu);
task_pid_nr(p), p->comm, dead_cpu);
} }
} }
...@@ -7805,48 +7804,44 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, ...@@ -7805,48 +7804,44 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
printk(KERN_DEBUG "%*s domain %d: ", level, "", level); printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
if (!(sd->flags & SD_LOAD_BALANCE)) { if (!(sd->flags & SD_LOAD_BALANCE)) {
printk("does not load-balance\n"); pr_cont("does not load-balance\n");
if (sd->parent) if (sd->parent)
printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain" pr_err("ERROR: !SD_LOAD_BALANCE domain has parent\n");
" has parent");
return -1; return -1;
} }
printk(KERN_CONT "span %s level %s\n", str, sd->name); pr_cont("span %s level %s\n", str, sd->name);
if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) { if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
printk(KERN_ERR "ERROR: domain->span does not contain " pr_err("ERROR: domain->span does not contain CPU%d\n", cpu);
"CPU%d\n", cpu);
} }
if (!cpumask_test_cpu(cpu, sched_group_cpus(group))) { if (!cpumask_test_cpu(cpu, sched_group_cpus(group))) {
printk(KERN_ERR "ERROR: domain->groups does not contain" pr_err("ERROR: domain->groups does not contain CPU%d\n", cpu);
" CPU%d\n", cpu);
} }
printk(KERN_DEBUG "%*s groups:", level + 1, ""); printk(KERN_DEBUG "%*s groups:", level + 1, "");
do { do {
if (!group) { if (!group) {
printk("\n"); pr_cont("\n");
printk(KERN_ERR "ERROR: group is NULL\n"); pr_err("ERROR: group is NULL\n");
break; break;
} }
if (!group->cpu_power) { if (!group->cpu_power) {
printk(KERN_CONT "\n"); pr_cont("\n");
printk(KERN_ERR "ERROR: domain->cpu_power not " pr_err("ERROR: domain->cpu_power not set\n");
"set\n");
break; break;
} }
if (!cpumask_weight(sched_group_cpus(group))) { if (!cpumask_weight(sched_group_cpus(group))) {
printk(KERN_CONT "\n"); pr_cont("\n");
printk(KERN_ERR "ERROR: empty group\n"); pr_err("ERROR: empty group\n");
break; break;
} }
if (cpumask_intersects(groupmask, sched_group_cpus(group))) { if (cpumask_intersects(groupmask, sched_group_cpus(group))) {
printk(KERN_CONT "\n"); pr_cont("\n");
printk(KERN_ERR "ERROR: repeated CPUs\n"); pr_err("ERROR: repeated CPUs\n");
break; break;
} }
...@@ -7854,23 +7849,21 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, ...@@ -7854,23 +7849,21 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group)); cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group));
printk(KERN_CONT " %s", str); pr_cont(" %s", str);
if (group->cpu_power != SCHED_LOAD_SCALE) { if (group->cpu_power != SCHED_LOAD_SCALE) {
printk(KERN_CONT " (cpu_power = %d)", pr_cont(" (cpu_power = %d)", group->cpu_power);
group->cpu_power);
} }
group = group->next; group = group->next;
} while (group != sd->groups); } while (group != sd->groups);
printk(KERN_CONT "\n"); pr_cont("\n");
if (!cpumask_equal(sched_domain_span(sd), groupmask)) if (!cpumask_equal(sched_domain_span(sd), groupmask))
printk(KERN_ERR "ERROR: groups don't span domain->span\n"); pr_err("ERROR: groups don't span domain->span\n");
if (sd->parent && if (sd->parent &&
!cpumask_subset(groupmask, sched_domain_span(sd->parent))) !cpumask_subset(groupmask, sched_domain_span(sd->parent)))
printk(KERN_ERR "ERROR: parent span is not a superset " pr_err("ERROR: parent span is not a superset of domain->span\n");
"of domain->span\n");
return 0; return 0;
} }
...@@ -8426,8 +8419,7 @@ static int build_numa_sched_groups(struct s_data *d, ...@@ -8426,8 +8419,7 @@ static int build_numa_sched_groups(struct s_data *d,
sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(), sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(),
GFP_KERNEL, num); GFP_KERNEL, num);
if (!sg) { if (!sg) {
printk(KERN_WARNING "Can not alloc domain group for node %d\n", pr_warning("Can not alloc domain group for node %d\n", num);
num);
return -ENOMEM; return -ENOMEM;
} }
d->sched_group_nodes[num] = sg; d->sched_group_nodes[num] = sg;
...@@ -8456,8 +8448,8 @@ static int build_numa_sched_groups(struct s_data *d, ...@@ -8456,8 +8448,8 @@ static int build_numa_sched_groups(struct s_data *d,
sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(), sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(),
GFP_KERNEL, num); GFP_KERNEL, num);
if (!sg) { if (!sg) {
printk(KERN_WARNING pr_warning("Can not alloc domain group for node %d\n",
"Can not alloc domain group for node %d\n", j); j);
return -ENOMEM; return -ENOMEM;
} }
sg->cpu_power = 0; sg->cpu_power = 0;
...@@ -8685,7 +8677,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d, ...@@ -8685,7 +8677,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
d->sched_group_nodes = kcalloc(nr_node_ids, d->sched_group_nodes = kcalloc(nr_node_ids,
sizeof(struct sched_group *), GFP_KERNEL); sizeof(struct sched_group *), GFP_KERNEL);
if (!d->sched_group_nodes) { if (!d->sched_group_nodes) {
printk(KERN_WARNING "Can not alloc sched group node list\n"); pr_warning("Can not alloc sched group node list\n");
return sa_notcovered; return sa_notcovered;
} }
sched_group_nodes_bycpu[cpumask_first(cpu_map)] = d->sched_group_nodes; sched_group_nodes_bycpu[cpumask_first(cpu_map)] = d->sched_group_nodes;
...@@ -8702,7 +8694,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d, ...@@ -8702,7 +8694,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
return sa_send_covered; return sa_send_covered;
d->rd = alloc_rootdomain(); d->rd = alloc_rootdomain();
if (!d->rd) { if (!d->rd) {
printk(KERN_WARNING "Cannot alloc root domain\n"); pr_warning("Cannot alloc root domain\n");
return sa_tmpmask; return sa_tmpmask;
} }
return sa_rootdomain; return sa_rootdomain;
...@@ -9684,13 +9676,11 @@ void __might_sleep(char *file, int line, int preempt_offset) ...@@ -9684,13 +9676,11 @@ void __might_sleep(char *file, int line, int preempt_offset)
return; return;
prev_jiffy = jiffies; prev_jiffy = jiffies;
printk(KERN_ERR pr_err("BUG: sleeping function called from invalid context at %s:%d\n",
"BUG: sleeping function called from invalid context at %s:%d\n", file, line);
file, line); pr_err("in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
printk(KERN_ERR in_atomic(), irqs_disabled(),
"in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n", current->pid, current->comm);
in_atomic(), irqs_disabled(),
current->pid, current->comm);
debug_show_held_locks(current); debug_show_held_locks(current);
if (irqs_disabled()) if (irqs_disabled())
......
...@@ -35,7 +35,7 @@ static void ...@@ -35,7 +35,7 @@ static void
dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep) dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep)
{ {
spin_unlock_irq(&rq->lock); spin_unlock_irq(&rq->lock);
printk(KERN_ERR "bad: scheduling from the idle thread!\n"); pr_err("bad: scheduling from the idle thread!\n");
dump_stack(); dump_stack();
spin_lock_irq(&rq->lock); spin_lock_irq(&rq->lock);
} }
......
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