* [PATCH] sched: change printk(KERN_<LEVEL>.. to pr_<level>()
@ 2022-05-26 9:10 Yu Zhe
2022-05-26 9:42 ` Joe Perches
2022-05-27 6:10 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Yu Zhe @ 2022-05-26 9:10 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, vschneid
Cc: linux-kernel, kernel-janitors, liqiong, Yu Zhe
Prefer pr_<level>(... to printk(KERN_<LEVEL> ..., change them.
Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
---
kernel/sched/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a247f8d9d417..4522bb3bbafb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5602,7 +5602,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
if (oops_in_progress)
return;
- 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);
@@ -5636,7 +5636,7 @@ static inline void schedule_debug(struct task_struct *prev, bool preempt)
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
if (!preempt && READ_ONCE(prev->__state) && prev->non_block_count) {
- printk(KERN_ERR "BUG: scheduling in a non-blocking section: %s/%d/%i\n",
+ pr_err("BUG: scheduling in a non-blocking section: %s/%d/%i\n",
prev->comm, prev->pid, prev->non_block_count);
dump_stack();
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
@@ -9370,7 +9370,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
lockdep_assert_rq_held(rq);
- printk("%sCPU%d enqueued tasks (%u total):\n", loglvl, cpu, rq->nr_running);
+ pr_warn("%sCPU%d enqueued tasks (%u total):\n", loglvl, cpu, rq->nr_running);
for_each_process_thread(g, p) {
if (task_cpu(p) != cpu)
continue;
@@ -9378,7 +9378,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
if (!task_on_rq_queued(p))
continue;
- printk("%s\tpid: %d, name: %s\n", loglvl, p->pid, p->comm);
+ pr_warn("%s\tpid: %d, name: %s\n", loglvl, p->pid, p->comm);
}
}
@@ -9773,8 +9773,8 @@ void __cant_sleep(const char *file, int line, int preempt_offset)
return;
prev_jiffy = jiffies;
- printk(KERN_ERR "BUG: assuming atomic context at %s:%d\n", file, line);
- printk(KERN_ERR "in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
+ pr_err("BUG: assuming atomic context at %s:%d\n", file, line);
+ pr_err("in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
in_atomic(), irqs_disabled(),
current->pid, current->comm);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sched: change printk(KERN_<LEVEL>.. to pr_<level>()
2022-05-26 9:10 [PATCH] sched: change printk(KERN_<LEVEL>.. to pr_<level>() Yu Zhe
@ 2022-05-26 9:42 ` Joe Perches
2022-05-27 6:10 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2022-05-26 9:42 UTC (permalink / raw)
To: Yu Zhe, mingo, peterz, juri.lelli, vincent.guittot,
dietmar.eggemann, rostedt, bsegall, mgorman, bristot, vschneid
Cc: linux-kernel, kernel-janitors, liqiong
On Thu, 2022-05-26 at 02:10 -0700, Yu Zhe wrote:
> Prefer pr_<level>(... to printk(KERN_<LEVEL> ..., change them.
Do remember that checkpatch is just a guide and isn't always correct.
You are responsible for verifying that anything it suggests is
converted properly.
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
[]
> @@ -9370,7 +9370,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
>
> lockdep_assert_rq_held(rq);
>
> - printk("%sCPU%d enqueued tasks (%u total):\n", loglvl, cpu, rq->nr_running);
> + pr_warn("%sCPU%d enqueued tasks (%u total):\n", loglvl, cpu, rq->nr_running);
This is _not_ a good change.
Do please look to see what loglvl is and if this change is appropriate.
> for_each_process_thread(g, p) {
> if (task_cpu(p) != cpu)
> continue;
> @@ -9378,7 +9378,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
> if (!task_on_rq_queued(p))
> continue;
>
> - printk("%s\tpid: %d, name: %s\n", loglvl, p->pid, p->comm);
> + pr_warn("%s\tpid: %d, name: %s\n", loglvl, p->pid, p->comm);
here too.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched: change printk(KERN_<LEVEL>.. to pr_<level>()
2022-05-26 9:10 [PATCH] sched: change printk(KERN_<LEVEL>.. to pr_<level>() Yu Zhe
2022-05-26 9:42 ` Joe Perches
@ 2022-05-27 6:10 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-05-27 6:10 UTC (permalink / raw)
To: Yu Zhe
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, vschneid, linux-kernel,
kernel-janitors, liqiong
On Thu, May 26, 2022 at 02:10:31AM -0700, Yu Zhe wrote:
> @@ -9370,7 +9370,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
>
> lockdep_assert_rq_held(rq);
>
> - printk("%sCPU%d enqueued tasks (%u total):\n", loglvl, cpu, rq->nr_running);
> + pr_warn("%sCPU%d enqueued tasks (%u total):\n", loglvl, cpu, rq->nr_running);
^^^^^^
Your patch is wrong. The code aready has loglvl but as a variable.
Don't start sending checkpatch stuff to kernel/sched. Better to get
some experience in drivers/staging/ because Greg deliberately leaves a
lot of garbage code for people to clean up and get experience.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-27 6:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 9:10 [PATCH] sched: change printk(KERN_<LEVEL>.. to pr_<level>() Yu Zhe
2022-05-26 9:42 ` Joe Perches
2022-05-27 6:10 ` Dan Carpenter
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.