[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20060822174152.7105aa33.kamezawa.hiroyu@jp.fujitsu.com>
Date: Tue, 22 Aug 2006 17:41:52 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Andrew Morton <akpm@...l.org>, ebiederm@...ssion.com, pj@....com,
saito.tadashi@...t.fujitsu.com
Subject: [RFC][PATCH] ps command race fix take2 [3/4] profile fix
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@...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);
}
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists