* [PATCH 0/1] Incorrect name of the idle tasks in SMP kernels v3 @ 2011-10-26 21:14 Carsten Emde 2011-10-26 21:14 ` [PATCH 1/1] Set the command " Carsten Emde 0 siblings, 1 reply; 3+ messages in thread From: Carsten Emde @ 2011-10-26 21:14 UTC (permalink / raw) To: Ingo Molnar Cc: Peter Zijlstra, Thomas Gleixner, Steven Rostedt, Carsten Emde, LKML, RT-users Hi Ingo, The command name of the idle tasks in SMP kernels was incorrect which resulted in misleading trace output. This patch fixes it. -Carsten. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] Set the command name of the idle tasks in SMP kernels v3 2011-10-26 21:14 [PATCH 0/1] Incorrect name of the idle tasks in SMP kernels v3 Carsten Emde @ 2011-10-26 21:14 ` Carsten Emde 2011-11-18 23:31 ` [tip:sched/core] sched: Set the command name of the idle tasks in SMP kernels tip-bot for Carsten Emde 0 siblings, 1 reply; 3+ messages in thread From: Carsten Emde @ 2011-10-26 21:14 UTC (permalink / raw) To: Ingo Molnar Cc: Peter Zijlstra, Thomas Gleixner, Steven Rostedt, Carsten Emde, LKML, RT-users [-- Attachment #1: kernel-sched-smp-set-idletask-comm.patch --] [-- Type: text/plain, Size: 2282 bytes --] 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> --- include/linux/init_task.h | 3 ++- kernel/sched.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) Index: linux-3.0.7-rt20/include/linux/init_task.h =================================================================== --- linux-3.0.7-rt20.orig/include/linux/init_task.h +++ linux-3.0.7-rt20/include/linux/init_task.h @@ -132,6 +132,7 @@ extern struct cred init_cred; # define INIT_TIMER_LIST #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) @@ -168,7 +169,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, \ Index: linux-3.0.7-rt20/kernel/sched.c =================================================================== --- linux-3.0.7-rt20.orig/kernel/sched.c +++ linux-3.0.7-rt20/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> @@ -6104,6 +6105,9 @@ void __cpuinit init_idle(struct task_str */ 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 } /* ^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:sched/core] sched: Set the command name of the idle tasks in SMP kernels 2011-10-26 21:14 ` [PATCH 1/1] Set the command " Carsten Emde @ 2011-11-18 23:31 ` tip-bot for Carsten Emde 0 siblings, 0 replies; 3+ messages in thread From: tip-bot for Carsten Emde @ 2011-11-18 23:31 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, C.Emde, mingo Commit-ID: f1c6f1a7eed963ed233ba4c8b6fa8addb86c6ddc Gitweb: http://git.kernel.org/tip/f1c6f1a7eed963ed233ba4c8b6fa8addb86c6ddc Author: Carsten Emde <C.Emde@osadl.org> AuthorDate: Wed, 26 Oct 2011 23:14:16 +0200 Committer: Ingo Molnar <mingo@elte.hu> CommitDate: Mon, 14 Nov 2011 12:50:43 +0100 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> --- include/linux/init_task.h | 4 +++- kernel/sched.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 08ffab0..b6e5b8b 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -126,6 +126,8 @@ 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 +164,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 3d2c436..d6b149c 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> @@ -6112,6 +6113,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 } /* ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-18 23:31 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-10-26 21:14 [PATCH 0/1] Incorrect name of the idle tasks in SMP kernels v3 Carsten Emde 2011-10-26 21:14 ` [PATCH 1/1] Set the command " Carsten Emde 2011-11-18 23:31 ` [tip:sched/core] sched: Set the command name of the idle tasks in SMP kernels tip-bot for Carsten Emde
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®