All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] workqueue: fix detecting reentrance
@ 2019-12-12  9:15 Hillf Danton
  2019-12-16 14:02 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Hillf Danton @ 2019-12-12  9:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, Hillf Danton


If we can find a valid worker that is serving the specified work at
the moment then the worker itself is enough to ensure reentrance and
workqueue doesn't matter here because it is permitted for a work to
requeue itself either on different cpu or numa node or even on another
workqueue.

Fixes: c9178087acd7 ("workqueue: perform non-reentrancy test when queueing to unbound workqueues too")
Fixes: 18aa9effad4a ("workqueue: implement WQ_NON_REENTRANT")
Signed-off-by: Hillf Danton <hdanton@sina.com>
---

--- f/kernel/workqueue.c
+++ g/kernel/workqueue.c
@@ -1433,7 +1433,7 @@ retry:
 
 		worker = find_worker_executing_work(last_pool, work);
 
-		if (worker && worker->current_pwq->wq == wq) {
+		if (worker) {
 			pwq = worker->current_pwq;
 		} else {
 			/* meh... not running there, queue here */



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] workqueue: fix detecting reentrance
  2019-12-12  9:15 [RFC] workqueue: fix detecting reentrance Hillf Danton
@ 2019-12-16 14:02 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2019-12-16 14:02 UTC (permalink / raw)
  To: Hillf Danton; +Cc: linux-kernel, linux-mm, Tejun Heo, Lai Jiangshan

Cc maintainers.

On Thu 12-12-19 17:15:48, Hillf Danton wrote:
> 
> If we can find a valid worker that is serving the specified work at
> the moment then the worker itself is enough to ensure reentrance and
> workqueue doesn't matter here because it is permitted for a work to
> requeue itself either on different cpu or numa node or even on another
> workqueue.

I do not follow what is the actual problem you are trying to fix here.

> Fixes: c9178087acd7 ("workqueue: perform non-reentrancy test when queueing to unbound workqueues too")
> Fixes: 18aa9effad4a ("workqueue: implement WQ_NON_REENTRANT")
> Signed-off-by: Hillf Danton <hdanton@sina.com>
> ---
> 
> --- f/kernel/workqueue.c
> +++ g/kernel/workqueue.c
> @@ -1433,7 +1433,7 @@ retry:
>  
>  		worker = find_worker_executing_work(last_pool, work);
>  
> -		if (worker && worker->current_pwq->wq == wq) {
> +		if (worker) {
>  			pwq = worker->current_pwq;
>  		} else {
>  			/* meh... not running there, queue here */
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-16 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12  9:15 [RFC] workqueue: fix detecting reentrance Hillf Danton
2019-12-16 14:02 ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.