* [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
* Re: [RFC][PATCH] ps command race fix take2 [3/4] profile fix
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
0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2006-08-22 11:08 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, ebiederm, pj, saito.tadashi, linux-kernel
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> writes:
> ===================================================================
> --- 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
Sorry I think this needs a cleaner solution without ifdef. Why can't it use
the token list? Or some other list head that's unused then.
Otherwise I would think it it better to use a separate list object to
maintain this list in oprofile.
-Andi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC][PATCH] ps command race fix take2 [3/4] profile fix
2006-08-22 11:08 ` Andi Kleen
@ 2006-08-22 11:28 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 3+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-08-22 11:28 UTC (permalink / raw)
To: Andi Kleen; +Cc: akpm, ebiederm, pj, saito.tadashi, linux-kernel
On 22 Aug 2006 13:08:49 +0200
Andi Kleen <ak@suse.de> wrote:
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> writes:
>
> > ===================================================================
> > --- 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
>
> Sorry I think this needs a cleaner solution without ifdef. Why can't it use
> the token list? Or some other list head that's unused then.
>
I added them because oprofile doesn't need tokened-list. But adding new
member only for this seems a bit expensive as you point out.
I'll find another way, reuse some list_head or use tokened-list.
-Kame
^ 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®