linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carsten Emde <C.Emde@osadl.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Carsten Emde <C.Emde@osadl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	RT-users <linux-rt-users@vger.kernel.org>
Subject: [PATCH 1/1] Set the command name of the idle tasks in SMP kernels v3
Date: Wed, 26 Oct 2011 23:14:16 +0200	[thread overview]
Message-ID: <20111026211708.768925506@osadl.org> (raw)
In-Reply-To: 20111026211415.787299186@osadl.org

[-- Attachment #1: kernel-sched-smp-set-idletask-comm.patch --]
[-- Type: text/plain, Size: 2281 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
 }
 
 /*

      reply	other threads:[~2011-10-26 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=20111026211708.768925506@osadl.org \
    --to=c.emde@osadl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).