lkml.org 
[lkml]   [2014]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit
Hello, Lai.

On Fri, Apr 18, 2014 at 12:04:29AM +0800, Lai Jiangshan wrote:
> > I don't think this is reliable. What if mayday requests take place
> > between wq_mayday_lock and kthread_should_stop() check? We'll
> > probably need to run through mayday list after checking should_stop.
>
> It is destroy_workqueue()'s responsibility to avoid this.
> destroy_workqueue() should drain all works and refuse any new work queued
> on the wq before destroy the wq.
>
> So since there is no works, there is no new mayday request,
> and there is no mayday request take place between wq_mayday_lock
> and kthread_should_stop() check.

Hmmm? Isn't this the same race condition that you tried to remove by
relocating the test? It doesn't matter what destroy_workqueue() does,
the rescuer may get preempted inbetween and anything can happen
inbetween including someone maydaying and initiation of
destroy_workqueue(). Your patch doesn't change the situation at all.
It can still return with non-empty mayday list.

Thanks.

--
tejun


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