[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090521130528.GA14149@redhat.com>
Date: Thu, 21 May 2009 15:05:28 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Zhaolei <zhaolei@...fujitsu.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...e.hu>, Tom Zanussi <tzanussi@...il.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing/workqueue: Get rid of searching last executed
worklet in probe_worklet_complete()
On 05/21, Zhaolei wrote:
>
> We don't need search workqueue's worklet list for worklet which was latest
> executed, instead, we can use a pointer in cpu_workqueue_stats to remember
> which worklet was just executed.
Minor nit,
> @@ -192,22 +192,11 @@ probe_worklet_complete(struct task_struct *wq_thread, void *work)
> goto end;
>
> found_wq:
> - list_for_each_entry(wfnode, &node->workfunclist, list) {
> - u64 executed_time;
> + executed_time = trace_clock_global() - node->last_workfunc->start_time;
> + node->last_workfunc->total_time += executed_time;
Suppose that "enqueue" handler fails to allocate the memory for the new
work_struct.
This means that the "execute" handler does not record ->last_workfunc.
In that case probe_worklet_complete() uses the wrong workfunc_stats or
we can even crash if ->last_workfunc == NULL.
I think _execute() should set ->last_workfunc = NULL first, then serach
for wfnode. _complete() should check ->last_workfunc != NULL and return
if it is NULL.
Oleg.
--
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