lkml.org 
[lkml]   [2009]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] tracing/workqueue: Get rid of searching last executedworklet in probe_worklet_complete()
Date
* From: "Oleg Nesterov" <oleg@redhat.com>
> 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.
Hello, Oleg

Thanks!
You are right, I will send v2 to fix this.

Zhaolei
\
 
 \ /
  Last update: 2009-05-22 02:47    [from the cache]
©2003-2011 Jasper Spaans