aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Emde <C.Emde@osadl.org>2011-10-26 17:14:16 -0400
committerIngo Molnar <mingo@elte.hu>2011-11-14 06:50:43 -0500
commitf1c6f1a7eed963ed233ba4c8b6fa8addb86c6ddc (patch)
tree06a00ecfe00ddadb282c88fb3408c158c08fd312
parent4a6184ce7a48c478dee0d8a9ed74c1fa35161858 (diff)
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. 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. Signed-off-by: Carsten Emde <C.Emde@osadl.org> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20111026211708.768925506@osadl.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--include/linux/init_task.h4
-rw-r--r--kernel/sched.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 08ffab01e76c..b6e5b8b000e0 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -126,6 +126,8 @@ extern struct cred init_cred;
126# define INIT_PERF_EVENTS(tsk) 126# define INIT_PERF_EVENTS(tsk)
127#endif 127#endif
128 128
129#define INIT_TASK_COMM "swapper"
130
129/* 131/*
130 * INIT_TASK is used to set up the first task table, touch at 132 * INIT_TASK is used to set up the first task table, touch at
131 * your own risk!. Base=0, limit=0x1fffff (=2MB) 133 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -162,7 +164,7 @@ extern struct cred init_cred;
162 .group_leader = &tsk, \ 164 .group_leader = &tsk, \
163 RCU_INIT_POINTER(.real_cred, &init_cred), \ 165 RCU_INIT_POINTER(.real_cred, &init_cred), \
164 RCU_INIT_POINTER(.cred, &init_cred), \ 166 RCU_INIT_POINTER(.cred, &init_cred), \
165 .comm = "swapper", \ 167 .comm = INIT_TASK_COMM, \
166 .thread = INIT_THREAD, \ 168 .thread = INIT_THREAD, \
167 .fs = &init_fs, \ 169 .fs = &init_fs, \
168 .files = &init_files, \ 170 .files = &init_files, \
diff --git a/kernel/sched.c b/kernel/sched.c
index 3d2c436959a1..d6b149ccf925 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -71,6 +71,7 @@
71#include <linux/ctype.h> 71#include <linux/ctype.h>
72#include <linux/ftrace.h> 72#include <linux/ftrace.h>
73#include <linux/slab.h> 73#include <linux/slab.h>
74#include <linux/init_task.h>
74 75
75#include <asm/tlb.h> 76#include <asm/tlb.h>
76#include <asm/irq_regs.h> 77#include <asm/irq_regs.h>
@@ -6112,6 +6113,9 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
6112 */ 6113 */
6113 idle->sched_class = &idle_sched_class; 6114 idle->sched_class = &idle_sched_class;
6114 ftrace_graph_init_idle_task(idle, cpu); 6115 ftrace_graph_init_idle_task(idle, cpu);
6116#if defined(CONFIG_SMP)
6117 sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
6118#endif
6115} 6119}
6116 6120
6117/* 6121/*