[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z-7ZZThD2i2-yw8R@slm.duckdns.org>
Date: Thu, 3 Apr 2025 08:54:29 -1000
From: Tejun Heo <tj@...nel.org>
To: Philipp Stanner <phasta@...nel.org>
Cc: Lai Jiangshan <jiangshanlai@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] workqueue: Better document teardown for delayed_work
Hello,
On Thu, Apr 03, 2025 at 10:31:56AM +0200, Philipp Stanner wrote:
> destroy_workqueue() does not ensure that non-pending work submitted with
> queue_delayed_work() gets cancelled. The caller has to ensure that
> manually.
>
> Add this information about delayed_work in destroy_workqueue()'s
> docstring.
>
> Signed-off-by: Philipp Stanner <phasta@...nel.org>
> ---
> Hi,
>
> I have seen this WARN_ON [1] fire in my code for testing the DRM GPU
> Scheduler, where a (non-delayed) work_item from workqueue A submits
> delayed_work to workqueue B [2].
>
> From my experience so far and reading the documentation, I didn't expect
> this to happen.
>
> Assuming this is wanted behavior (?), I propose documenting this more
> explicitly. Or could it be possible to modify destroy_workqueue() so
> that it takes care of submitted delayed_work()?
This is definitely not a "wanted" behavior. The problem is that delayed work
items are only linked on the timer side and we don't have a way to list all
timers that are queued for work items on a specific workqueue, and there's
no way of adding that without incurring extra overhead. Maybe that'd be a
worthwhile trade-off to make, I don't know.
Can you please fortify the text a bit with the fact that this isn't a
desirable behavior but workqueue currently doesn't have a way of locating
the delayed timers queued on its behalf?
Thanks.
--
tejun
Powered by blists - more mailing lists