[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPgBjmIm6n9H-R_u@slm.duckdns.org>
Date: Tue, 21 Oct 2025 11:56:30 -1000
From: Tejun Heo <tj@...nel.org>
To: Matthew Brost <matthew.brost@...el.com>
Cc: intel-xe@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, jiangshanlai@...il.com,
simona.vetter@...ll.ch, christian.koenig@....com,
pstanner@...hat.com, dakr@...nel.org
Subject: Re: [RFC PATCH 1/3] workqueue: Add an interface to taint workqueue
lockdep with reclaim
Hello,
On Tue, Oct 21, 2025 at 02:39:50PM -0700, Matthew Brost wrote:
> Drivers often use workqueues that are in the reclaim path (e.g., DRM
> scheduler workqueues). It is useful to teach lockdep that memory cannot
> be allocated on these workqueues. Add an interface to taint workqueue
> lockdep with reclaim.
Given that it's about reclaim, "memory cannot be allocated" may be a bit
misleading. Can you make the description more accurate? Also, it'd be great
if you can include an example lockdep splat for reference.
> Cc: Tejun Heo <tj@...nel.org>
> Cc: Lai Jiangshan <jiangshanlai@...il.com>
> Signed-off-by: Matthew Brost <matthew.brost@...el.com>
> ---
> include/linux/workqueue.h | 19 +++++++++++++++++++
> kernel/workqueue.c | 9 +++++++++
> 2 files changed, 28 insertions(+)
>
> diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
> index dabc351cc127..954c7eb7e225 100644
> --- a/include/linux/workqueue.h
> +++ b/include/linux/workqueue.h
> @@ -553,6 +553,25 @@ alloc_workqueue_lockdep_map(const char *fmt, unsigned int flags, int max_active,
> 1, lockdep_map, ##args))
> #endif
>
> +
> +#ifdef CONFIG_LOCKDEP
> +/**
> + * taint_reclaim_workqueue - taint workqueue lockdep map with reclaim
> + * @wq: workqueue to taint with reclaim
> + * gfp: gfp taint
^@
> + *
> + * Drivers often use workqueues that are in the reclaim path (e.g., DRM
> + * scheduler workqueues). It is useful to teach lockdep that memory cannot be
> + * allocated on these workqueues.
> + */
> +extern void taint_reclaim_workqueue(struct workqueue_struct *wq, gfp_t gfp);
> +#else
> +static inline void taint_reclaim_workqueue(struct workqueue_struct *wq,
> + gfp_t gfp)
Would a more direct name work better, maybe something like
workqueue_warn_on_reclaim()?
Hmm... would it make sense to tie this to WQ_MEM_RECLAIM - ie. enable it
implicitly on workqueues w/ the flag set?
Thanks.
--
tejun
Powered by blists - more mailing lists