Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Tejun Heo
On Fri, Apr 18, 2014 at 12:21:51AM +0800, Lai Jiangshan wrote: > > 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

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Lai Jiangshan
On Fri, Apr 18, 2014 at 12:08 AM, Tejun Heo wrote: > 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

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Tejun Heo
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

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Lai Jiangshan
On Thu, Apr 17, 2014 at 11:27 PM, Tejun Heo wrote: > Hello, > > On Thu, Apr 17, 2014 at 07:34:08AM +0800, Lai Jiangshan wrote: >> Before the rescuer is picked to running, the works of the @pwq >> may be processed by some other workers, and destroy_workqueue() >> may called at the same time. This

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Tejun Heo
Hello, On Thu, Apr 17, 2014 at 07:34:08AM +0800, Lai Jiangshan wrote: > Before the rescuer is picked to running, the works of the @pwq > may be processed by some other workers, and destroy_workqueue() > may called at the same time. This may result a nasty situation > that rescuer may exit with

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Tejun Heo
Hello, On Thu, Apr 17, 2014 at 07:34:08AM +0800, Lai Jiangshan wrote: Before the rescuer is picked to running, the works of the @pwq may be processed by some other workers, and destroy_workqueue() may called at the same time. This may result a nasty situation that rescuer may exit with

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Lai Jiangshan
On Thu, Apr 17, 2014 at 11:27 PM, Tejun Heo t...@kernel.org wrote: Hello, On Thu, Apr 17, 2014 at 07:34:08AM +0800, Lai Jiangshan wrote: Before the rescuer is picked to running, the works of the @pwq may be processed by some other workers, and destroy_workqueue() may called at the same time.

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Tejun Heo
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

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Lai Jiangshan
On Fri, Apr 18, 2014 at 12:08 AM, Tejun Heo t...@kernel.org wrote: 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

Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-17 Thread Tejun Heo
On Fri, Apr 18, 2014 at 12:21:51AM +0800, Lai Jiangshan wrote: 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

[PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-16 Thread Lai Jiangshan
Before the rescuer is picked to running, the works of the @pwq may be processed by some other workers, and destroy_workqueue() may called at the same time. This may result a nasty situation that rescuer may exit with non-empty mayday list. It is no harm currently, destroy_workqueue() can safely

[PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit

2014-04-16 Thread Lai Jiangshan
Before the rescuer is picked to running, the works of the @pwq may be processed by some other workers, and destroy_workqueue() may called at the same time. This may result a nasty situation that rescuer may exit with non-empty mayday list. It is no harm currently, destroy_workqueue() can safely