All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Sanford <crsanford@gmail.com>
To: kernel-janitors@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org
Subject: Re: [PATCH] include KERN_* constant in printk calls
Date: Thu, 21 May 2009 02:46:35 +0000	[thread overview]
Message-ID: <20090521024635.GA4030@chrisubuntu-laptop> (raw)
In-Reply-To: <20090520083719.GG6736@elte.hu>

Here is the updated patch for sched.c. It replaces all the printk calls with their
corresponding pr_* call. The five KERN_DEBUG calls have been changed to
pr_info.

Signed-off-by: Chris Sanford <crsanford@gmail.com>

---


diff --git a/kernel/sched.c b/kernel/sched.c
index 26efa47..cfe42e7 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4912,7 +4912,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
 {
 	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());
 
 	debug_show_held_locks(prev);
@@ -6474,23 +6474,23 @@ void sched_show_task(struct task_struct *p)
 	unsigned state;
 
 	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] : '?');
 #if BITS_PER_LONG = 32
 	if (state = TASK_RUNNING)
-		printk(KERN_CONT " running  ");
+		pr_cont(" running  ");
 	else
-		printk(KERN_CONT " %08lx ", thread_saved_pc(p));
+		pr_cont(" %08lx ", thread_saved_pc(p));
 #else
 	if (state = TASK_RUNNING)
-		printk(KERN_CONT "  running task    ");
+		pr_cont("  running task    ");
 	else
-		printk(KERN_CONT " %016lx ", thread_saved_pc(p));
+		pr_cont(" %016lx ", thread_saved_pc(p));
 #endif
 #ifdef CONFIG_DEBUG_STACK_USAGE
 	free = stack_not_used(p);
 #endif
-	printk(KERN_CONT "%5lu %5d %6d\n", free,
+	pr_cont("%5lu %5d %6d\n", free,
 		task_pid_nr(p), task_pid_nr(p->real_parent));
 
 	show_stack(p, NULL);
@@ -6501,10 +6501,10 @@ void show_state_filter(unsigned long state_filter)
 	struct task_struct *g, *p;
 
 #if BITS_PER_LONG = 32
-	printk(KERN_INFO
+	pr_info(
 		"  task                PC stack   pid father\n");
 #else
-	printk(KERN_INFO
+	pr_info(
 		"  task                        PC stack   pid father\n");
 #endif
 	read_lock(&tasklist_lock);
@@ -6833,7 +6833,7 @@ again:
 		 * leave kernel.
 		 */
 		if (p->mm && printk_ratelimit()) {
-			printk(KERN_INFO "process %d (%s) no "
+			pr_info("process %d (%s) no "
 			       "longer affine to cpu%d\n",
 			       task_pid_nr(p), p->comm, dead_cpu);
 		}
@@ -7315,52 +7315,52 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 
 	cpulist_scnprintf(str, sizeof(str), sched_domain_span(sd));
 	cpumask_clear(groupmask);
-
-	printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
-
+	
+	pr_info("%*s domain %d: ", level, "", level);
+	
 	if (!(sd->flags & SD_LOAD_BALANCE)) {
-		printk("does not load-balance\n");
+		pr_cont("does not load-balance\n");
 		if (sd->parent)
-			printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
+			pr_err("ERROR: !SD_LOAD_BALANCE domain"
 					" has parent");
 		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))) {
-		printk(KERN_ERR "ERROR: domain->span does not contain "
+		pr_err("ERROR: domain->span does not contain "
 				"CPU%d\n", cpu);
 	}
 	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);
 	}
 
-	printk(KERN_DEBUG "%*s groups:", level + 1, "");
+	pr_info("%*s groups:", level + 1, "");
 	do {
 		if (!group) {
-			printk("\n");
-			printk(KERN_ERR "ERROR: group is NULL\n");
+			pr_cont("\n");
+			pr_err("ERROR: group is NULL\n");
 			break;
 		}
 
 		if (!group->__cpu_power) {
-			printk(KERN_CONT "\n");
-			printk(KERN_ERR "ERROR: domain->cpu_power not "
+			pr_cont("\n");
+			pr_err("ERROR: domain->cpu_power not "
 					"set\n");
 			break;
 		}
 
 		if (!cpumask_weight(sched_group_cpus(group))) {
-			printk(KERN_CONT "\n");
-			printk(KERN_ERR "ERROR: empty group\n");
+			pr_cont("\n");
+			pr_err("ERROR: empty group\n");
 			break;
 		}
 
 		if (cpumask_intersects(groupmask, sched_group_cpus(group))) {
-			printk(KERN_CONT "\n");
-			printk(KERN_ERR "ERROR: repeated CPUs\n");
+			pr_cont("\n");
+			pr_err("ERROR: repeated CPUs\n");
 			break;
 		}
 
@@ -7368,22 +7368,22 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 
 		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) {
-			printk(KERN_CONT " (__cpu_power = %d)",
+			pr_cont(" (__cpu_power = %d)",
 				group->__cpu_power);
 		}
 
 		group = group->next;
 	} while (group != sd->groups);
-	printk(KERN_CONT "\n");
+	pr_cont("\n");
 
 	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 &&
 	    !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");
 	return 0;
 }
@@ -7394,14 +7394,14 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu)
 	int level = 0;
 
 	if (!sd) {
-		printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
+		pr_info("CPU%d attaching NULL sched-domain.\n", cpu);
 		return;
 	}
 
-	printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
+	pr_info("CPU%d attaching sched-domain:\n", cpu);
 
 	if (!alloc_cpumask_var(&groupmask, GFP_KERNEL)) {
-		printk(KERN_DEBUG "Cannot load-balance (out of memory)\n");
+		pr_info("Cannot load-balance (out of memory)\n");
 		return;
 	}
 
@@ -8095,14 +8095,14 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
 	sched_group_nodes = kcalloc(nr_node_ids, sizeof(struct sched_group *),
 				    GFP_KERNEL);
 	if (!sched_group_nodes) {
-		printk(KERN_WARNING "Can not alloc sched group node list\n");
+		pr_warning("Can not alloc sched group node list\n");
 		goto free_tmpmask;
 	}
 #endif
 
 	rd = alloc_rootdomain();
 	if (!rd) {
-		printk(KERN_WARNING "Cannot alloc root domain\n");
+		pr_warning("Cannot alloc root domain\n");
 		goto free_sched_groups;
 	}
 
@@ -8241,7 +8241,7 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
 		sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(),
 				  GFP_KERNEL, i);
 		if (!sg) {
-			printk(KERN_WARNING "Can not alloc domain group for "
+			pr_warning("Can not alloc domain group for "
 				"node %d\n", i);
 			goto error;
 		}
@@ -8275,7 +8275,7 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
 					  cpumask_size(),
 					  GFP_KERNEL, i);
 			if (!sg) {
-				printk(KERN_WARNING
+				pr_warning(
 				"Can not alloc domain group for node %d\n", j);
 				goto error;
 			}
@@ -9075,10 +9075,10 @@ void __might_sleep(char *file, int line)
 		return;
 	prev_jiffy = jiffies;
 
-	printk(KERN_ERR
+	pr_err(
 		"BUG: sleeping function called from invalid context at %s:%d\n",
 			file, line);
-	printk(KERN_ERR
+	pr_err(
 		"in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
 			in_atomic(), irqs_disabled(),
 			current->pid, current->comm);

WARNING: multiple messages have this Message-ID (diff)
From: Chris Sanford <crsanford@gmail.com>
To: kernel-janitors@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org
Subject: Re: [PATCH] include KERN_* constant in printk calls
Date: Wed, 20 May 2009 19:46:35 -0700	[thread overview]
Message-ID: <20090521024635.GA4030@chrisubuntu-laptop> (raw)
In-Reply-To: <20090520083719.GG6736@elte.hu>

Here is the updated patch for sched.c. It replaces all the printk calls with their
corresponding pr_* call. The five KERN_DEBUG calls have been changed to
pr_info.

Signed-off-by: Chris Sanford <crsanford@gmail.com>

---


diff --git a/kernel/sched.c b/kernel/sched.c
index 26efa47..cfe42e7 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4912,7 +4912,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
 {
 	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());
 
 	debug_show_held_locks(prev);
@@ -6474,23 +6474,23 @@ void sched_show_task(struct task_struct *p)
 	unsigned state;
 
 	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] : '?');
 #if BITS_PER_LONG == 32
 	if (state == TASK_RUNNING)
-		printk(KERN_CONT " running  ");
+		pr_cont(" running  ");
 	else
-		printk(KERN_CONT " %08lx ", thread_saved_pc(p));
+		pr_cont(" %08lx ", thread_saved_pc(p));
 #else
 	if (state == TASK_RUNNING)
-		printk(KERN_CONT "  running task    ");
+		pr_cont("  running task    ");
 	else
-		printk(KERN_CONT " %016lx ", thread_saved_pc(p));
+		pr_cont(" %016lx ", thread_saved_pc(p));
 #endif
 #ifdef CONFIG_DEBUG_STACK_USAGE
 	free = stack_not_used(p);
 #endif
-	printk(KERN_CONT "%5lu %5d %6d\n", free,
+	pr_cont("%5lu %5d %6d\n", free,
 		task_pid_nr(p), task_pid_nr(p->real_parent));
 
 	show_stack(p, NULL);
@@ -6501,10 +6501,10 @@ void show_state_filter(unsigned long state_filter)
 	struct task_struct *g, *p;
 
 #if BITS_PER_LONG == 32
-	printk(KERN_INFO
+	pr_info(
 		"  task                PC stack   pid father\n");
 #else
-	printk(KERN_INFO
+	pr_info(
 		"  task                        PC stack   pid father\n");
 #endif
 	read_lock(&tasklist_lock);
@@ -6833,7 +6833,7 @@ again:
 		 * leave kernel.
 		 */
 		if (p->mm && printk_ratelimit()) {
-			printk(KERN_INFO "process %d (%s) no "
+			pr_info("process %d (%s) no "
 			       "longer affine to cpu%d\n",
 			       task_pid_nr(p), p->comm, dead_cpu);
 		}
@@ -7315,52 +7315,52 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 
 	cpulist_scnprintf(str, sizeof(str), sched_domain_span(sd));
 	cpumask_clear(groupmask);
-
-	printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
-
+	
+	pr_info("%*s domain %d: ", level, "", level);
+	
 	if (!(sd->flags & SD_LOAD_BALANCE)) {
-		printk("does not load-balance\n");
+		pr_cont("does not load-balance\n");
 		if (sd->parent)
-			printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
+			pr_err("ERROR: !SD_LOAD_BALANCE domain"
 					" has parent");
 		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))) {
-		printk(KERN_ERR "ERROR: domain->span does not contain "
+		pr_err("ERROR: domain->span does not contain "
 				"CPU%d\n", cpu);
 	}
 	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);
 	}
 
-	printk(KERN_DEBUG "%*s groups:", level + 1, "");
+	pr_info("%*s groups:", level + 1, "");
 	do {
 		if (!group) {
-			printk("\n");
-			printk(KERN_ERR "ERROR: group is NULL\n");
+			pr_cont("\n");
+			pr_err("ERROR: group is NULL\n");
 			break;
 		}
 
 		if (!group->__cpu_power) {
-			printk(KERN_CONT "\n");
-			printk(KERN_ERR "ERROR: domain->cpu_power not "
+			pr_cont("\n");
+			pr_err("ERROR: domain->cpu_power not "
 					"set\n");
 			break;
 		}
 
 		if (!cpumask_weight(sched_group_cpus(group))) {
-			printk(KERN_CONT "\n");
-			printk(KERN_ERR "ERROR: empty group\n");
+			pr_cont("\n");
+			pr_err("ERROR: empty group\n");
 			break;
 		}
 
 		if (cpumask_intersects(groupmask, sched_group_cpus(group))) {
-			printk(KERN_CONT "\n");
-			printk(KERN_ERR "ERROR: repeated CPUs\n");
+			pr_cont("\n");
+			pr_err("ERROR: repeated CPUs\n");
 			break;
 		}
 
@@ -7368,22 +7368,22 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 
 		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) {
-			printk(KERN_CONT " (__cpu_power = %d)",
+			pr_cont(" (__cpu_power = %d)",
 				group->__cpu_power);
 		}
 
 		group = group->next;
 	} while (group != sd->groups);
-	printk(KERN_CONT "\n");
+	pr_cont("\n");
 
 	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 &&
 	    !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");
 	return 0;
 }
@@ -7394,14 +7394,14 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu)
 	int level = 0;
 
 	if (!sd) {
-		printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
+		pr_info("CPU%d attaching NULL sched-domain.\n", cpu);
 		return;
 	}
 
-	printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
+	pr_info("CPU%d attaching sched-domain:\n", cpu);
 
 	if (!alloc_cpumask_var(&groupmask, GFP_KERNEL)) {
-		printk(KERN_DEBUG "Cannot load-balance (out of memory)\n");
+		pr_info("Cannot load-balance (out of memory)\n");
 		return;
 	}
 
@@ -8095,14 +8095,14 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
 	sched_group_nodes = kcalloc(nr_node_ids, sizeof(struct sched_group *),
 				    GFP_KERNEL);
 	if (!sched_group_nodes) {
-		printk(KERN_WARNING "Can not alloc sched group node list\n");
+		pr_warning("Can not alloc sched group node list\n");
 		goto free_tmpmask;
 	}
 #endif
 
 	rd = alloc_rootdomain();
 	if (!rd) {
-		printk(KERN_WARNING "Cannot alloc root domain\n");
+		pr_warning("Cannot alloc root domain\n");
 		goto free_sched_groups;
 	}
 
@@ -8241,7 +8241,7 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
 		sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(),
 				  GFP_KERNEL, i);
 		if (!sg) {
-			printk(KERN_WARNING "Can not alloc domain group for "
+			pr_warning("Can not alloc domain group for "
 				"node %d\n", i);
 			goto error;
 		}
@@ -8275,7 +8275,7 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
 					  cpumask_size(),
 					  GFP_KERNEL, i);
 			if (!sg) {
-				printk(KERN_WARNING
+				pr_warning(
 				"Can not alloc domain group for node %d\n", j);
 				goto error;
 			}
@@ -9075,10 +9075,10 @@ void __might_sleep(char *file, int line)
 		return;
 	prev_jiffy = jiffies;
 
-	printk(KERN_ERR
+	pr_err(
 		"BUG: sleeping function called from invalid context at %s:%d\n",
 			file, line);
-	printk(KERN_ERR
+	pr_err(
 		"in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
 			in_atomic(), irqs_disabled(),
 			current->pid, current->comm);

  reply	other threads:[~2009-05-21  2:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18 23:31 [PATCH] include KERN_* constant in printk calls Chris Sanford
2009-05-18 23:31 ` Chris Sanford
2009-05-19  9:00 ` Ingo Molnar
2009-05-19  9:00   ` Ingo Molnar
2009-05-20  4:32   ` Chris Sanford
2009-05-20  4:32     ` Chris Sanford
2009-05-20  8:37     ` Ingo Molnar
2009-05-20  8:37       ` Ingo Molnar
2009-05-21  2:46       ` Chris Sanford [this message]
2009-05-21  2:46         ` Chris Sanford
2009-05-21  3:30         ` Joe Perches
2009-05-21  3:30           ` Joe Perches
2009-05-21  4:09           ` Chris Sanford
2009-05-21  4:09             ` Chris Sanford
2009-05-21  5:09         ` Michael Ellerman
2009-05-21  5:09           ` Michael Ellerman
2009-05-21  9:09           ` walter harms
2009-05-21  9:09             ` walter harms

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090521024635.GA4030@chrisubuntu-laptop \
    --to=crsanford@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.