lkml.org 
[lkml]   [2022]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: An announcement for kernel-global workqueue users.
Hello, Tetsuo.

On Mon, Mar 21, 2022 at 10:24:23AM +0900, Tetsuo Handa wrote:
> Hello.
>
> The Linux kernel provides kernel-global WQs (namely, system_wq, system_highpri_wq,
> system_long_wq, system_unbound_wq, system_freezable_wq, system_power_efficient_wq
> and system_freezable_power_efficient_wq). But since attempt to flush kernel-global
> WQs has possibility of deadlock, Tejun Heo thinks that we should stop calling
> flush_scheduled_work() and flush_workqueue(system_*). Such callers as of Linux 5.17
> are listed below.

Hey, so, I'm not too sure this approach would work. Someone would have to do
most of the legwork and ping the respective maintainers with proposed
patches explaining what's happening why and how the proposed patches are
safe.

> I tried to send a patch that emits a warning when flushing kernel-global WQs is attempted
> ( https://lkml.kernel.org/r/2efd5461-fccd-f1d9-7138-0a6767cbf5fe@I-love.SAKURA.ne.jp ).
> But Linus does not want such patch
> ( https://lkml.kernel.org/r/CAHk-=whWreGjEQ6yasspzBrNnS7EQiL+SknToWt=SzUh4XomyQ@mail.gmail.com ).

You can *float* these warning patches in -next to help with conversion if
necessary but you really have to convert most of the obvious existing users
beforehand.

> Step 2: Create a WQ for your module from __init function. The same flags
> used by corresponding kernel-global WQ can be used when creating
> the WQ for your module.
>
> my_wq = alloc_workqueue("my_wq_name", 0, 0);

And, the first preference would be converting to use flush_work() unless
defining a separate flush domain to flush multiple work items is absolutely
necessary.

Thanks.

--
tejun

\
 
 \ /
  Last update: 2022-03-21 17:46    [W:0.062 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site