lkml.org 
[lkml]   [2011]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH][GIT PULL] sched: Set the command name of the idle tasks in SMP kernels
From
Date
Ingo,

Please pull the latest tip/sched/core tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/sched/core

Head SHA1: 901f405ff7ff12c5643f0f1f8b06052079be1389


Carsten Emde (1):
sched: Set the command name of the idle tasks in SMP kernels

----
include/linux/init_task.h | 3 ++-
kernel/sched.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletions(-)
---------------------------
commit 901f405ff7ff12c5643f0f1f8b06052079be1389
Author: Carsten Emde <C.Emde@osadl.org>
Date: Wed Oct 26 23:14:16 2011 +0200

sched: Set the command name of the idle tasks in SMP kernels

In UP systems, the idle task is initialized using the init_task
structure from which the command name is taken (currently "swapper").

In SMP systems, one idle task per CPU is forked by the worker thread
from which the task structure is copied. The command name is, therefore,
"kworker/0:0" or "kworker/0:1", if not updated. Since such update was
lacking, all idle tasks in SMP systems were incorrectly named. This
longtime bug was not discovered immediately, because there is no /proc/0
entry - the bug only becomes apparent when tracing is enabled or if
a crash happens while current is the idle task. The displayed name
of the task will be kworker/0 instead of swapper. This has already
caused some confusion while debugging RCU.

Link: http://lkml.kernel.org/r/1320075882.4793.4.camel@gandalf.stny.rr.com

This patch sets the command name of the idle tasks in SMP systems to the
name that is used in the INIT_TASK structure suffixed by a slash and the
number of the CPU.

Link: http://lkml.kernel.org/r/20111026211708.768925506@osadl.org

Cc: stable@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d14e058..7da43db 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -126,6 +126,7 @@ extern struct cred init_cred;
# define INIT_PERF_EVENTS(tsk)
#endif

+#define INIT_TASK_COMM "swapper"
/*
* INIT_TASK is used to set up the first task table, touch at
* your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -162,7 +163,7 @@ extern struct cred init_cred;
.group_leader = &tsk, \
RCU_INIT_POINTER(.real_cred, &init_cred), \
RCU_INIT_POINTER(.cred, &init_cred), \
- .comm = "swapper", \
+ .comm = INIT_TASK_COMM, \
.thread = INIT_THREAD, \
.fs = &init_fs, \
.files = &init_files, \
diff --git a/kernel/sched.c b/kernel/sched.c
index 24637c7..4af20fd 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -71,6 +71,7 @@
#include <linux/ctype.h>
#include <linux/ftrace.h>
#include <linux/slab.h>
+#include <linux/init_task.h>

#include <asm/tlb.h>
#include <asm/irq_regs.h>
@@ -6098,6 +6099,9 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
*/
idle->sched_class = &idle_sched_class;
ftrace_graph_init_idle_task(idle, cpu);
+#if defined(CONFIG_SMP)
+ sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
+#endif
}

/*
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2011-11-02 20:19    [W:0.041 / U:2.872 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site