Re: [syzbot] possible deadlock in worker_thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022/02/15 19:43, Haakon Bugge wrote:
>> @@ -6070,6 +6087,13 @@ void __init workqueue_init_early(void)
>> 	       !system_unbound_wq || !system_freezable_wq ||
>> 	       !system_power_efficient_wq ||
>> 	       !system_freezable_power_efficient_wq);
>> +	system_wq->flags |= __WQ_SYSTEM_WIDE;
>> +	system_highpri_wq->flags |= __WQ_SYSTEM_WIDE;
>> +	system_long_wq->flags |= __WQ_SYSTEM_WIDE;
>> +	system_unbound_wq->flags |= __WQ_SYSTEM_WIDE;
>> +	system_freezable_wq->flags |= __WQ_SYSTEM_WIDE;
>> +	system_power_efficient_wq->flags |= __WQ_SYSTEM_WIDE;
>> +	system_freezable_power_efficient_wq->flags |= __WQ_SYSTEM_WIDE;
> 
> Better to OR this in, in the alloc_workqueue() call? Perceive the notion of an opaque object?
> 

I do not want to do like

-	system_wq = alloc_workqueue("events", 0, 0);
+	system_wq = alloc_workqueue("events", __WQ_SYSTEM_WIDE, 0);

because the intent of this change is to ask developers to create their own WQs.
If I pass __WQ_SYSTEM_WIDE to alloc_workqueue(), developers might by error create like

	srp_tl_err_wq = alloc_workqueue("srp_tl_err_wq", __WQ_SYSTEM_WIDE, 0);

because of

	system_wq = alloc_workqueue("events", __WQ_SYSTEM_WIDE, 0);

line. The __WQ_SYSTEM_WIDE is absolutely meant to be applied to only 'system_wq',
'system_highpri_wq', 'system_long_wq', 'system_unbound_wq', 'system_freezable_wq',
'system_power_efficient_wq' and 'system_freezable_power_efficient_wq' WQs, in order
to avoid calling flush_workqueue() on these system-wide WQs.

I wish I could define __WQ_SYSTEM_WIDE inside kernel/workqueue_internal.h, but
it seems that kernel/workqueue_internal.h does not define internal flags.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux