lkml.org 
[lkml]   [2014]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release
On 04/17/2014 12:50 AM, Tejun Heo wrote:
> Hello, Lai.
>
> On Thu, Apr 17, 2014 at 12:21:21AM +0800, Lai Jiangshan wrote:
>> OK. It is better to use get_pwq(). I will also change the above comments to:
>>
>> The base ref and the possible ref from rerscuer(stopped) are never
>> dropped on per-cpu pwqs.
>> Directly free the pwqs and wq.
>
> Hmmm, why does that matter? The base ref is the business of
> create/destroy path and as long as base ref is never put other refs
> just don't matter.
>
>> The reason I quickly dropped V1 and wrote the V2 is that I saw this comment.
>> "The base ref" is precise after I used get_pwq() in V1.
>>
>> Or to avoid to change to this comments.
>> I can also move the following code down to the bottom of the rescuer_thread().
>>
>> if (kthread_should_stop()) {
>> __set_current_state(TASK_RUNNING);
>> rescuer->task->flags &= ~PF_WQ_WORKER;
>> return 0;
>> }
>>
>> (I reply this email on browser, never mind the syntax).
>> Maybe the second choice are better.
>
> Hmmm... yeah, regardlesss of the above, it's a bit nasty that rescuer
> may exit with non-empty mayday list.
>

+ * The wq->maydays list maybe still have some pwqs linked,
+ * but it is safe to free them all together since the rescuer
+ * is stopped.

I just comment it without fix. It has no harm before, but it harms after I added a get_pwq().
Sorry.
Lai


\
 
 \ /
  Last update: 2014-04-17 01:01    [W:0.615 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site