mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC][PATCH] ps command race fix take2 [3/4] profile fix
@ 2006-08-22  8:41 KAMEZAWA Hiroyuki
  2006-08-22 11:08 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-08-22  8:41 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, ebiederm, pj, saito.tadashi

oprofile driver touches task->tasks.
But it doesn't have to use task->tasks, just list_head is needed.

Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

 drivers/oprofile/buffer_sync.c |    6 +++---
 include/linux/sched.h          |    4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

Index: linux-2.6.18-rc4/include/linux/sched.h
===================================================================
--- linux-2.6.18-rc4.orig/include/linux/sched.h
+++ linux-2.6.18-rc4/include/linux/sched.h
@@ -808,6 +808,10 @@ struct task_struct {
 	struct list_head ptrace_children;
 	struct list_head ptrace_list;
 
+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
+	struct list_head 	dead_tasks;
+#endif
+
 	struct mm_struct *mm, *active_mm;
 
 /* task state */
Index: linux-2.6.18-rc4/drivers/oprofile/buffer_sync.c
===================================================================
--- linux-2.6.18-rc4.orig/drivers/oprofile/buffer_sync.c
+++ linux-2.6.18-rc4/drivers/oprofile/buffer_sync.c
@@ -51,7 +51,7 @@ static int task_free_notify(struct notif
 	unsigned long flags;
 	struct task_struct * task = data;
 	spin_lock_irqsave(&task_mortuary, flags);
-	list_add(&task->tasks, &dying_tasks);
+	list_add(&task->dead_tasks, &dying_tasks);
 	spin_unlock_irqrestore(&task_mortuary, flags);
 	return NOTIFY_OK;
 }
@@ -446,8 +446,8 @@ static void process_task_mortuary(void)
 
 	spin_unlock_irqrestore(&task_mortuary, flags);
 
-	list_for_each_entry_safe(task, ttask, &local_dead_tasks, tasks) {
-		list_del(&task->tasks);
+	list_for_each_entry_safe(task, ttask, &local_dead_tasks, dead_tasks) {
+		list_del(&task->dead_tasks);
 		free_task(task);
 	}
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-22 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-22  8:41 [RFC][PATCH] ps command race fix take2 [3/4] profile fix KAMEZAWA Hiroyuki
2006-08-22 11:08 ` Andi Kleen
2006-08-22 11:28   ` KAMEZAWA Hiroyuki

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®