diff options
| author | Tejun Heo <tj@kernel.org> | 2026-10-07 08:01:02 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-10-07 08:01:02 -1000 |
| commit | 92b542db38bf7cb4de583b2ca37febc549db0ce4 (patch) | |
| tree | 30dcfdb338f7fdba597e1ec9314c2006df86f525 /kernel/workqueue.c | |
| parent | fee1265a725725dac0ff7459f912d69558798b36 (diff) | |
| parent | d1a4549a3645e55cc9ade09e360280590b3c9559 (diff) | |
| download | linux-next-92b542db38bf7cb4de583b2ca37febc549db0ce4.tar.gz linux-next-92b542db38bf7cb4de583b2ca37febc549db0ce4.zip | |
Merge branch 'for-7.3-fixes' into for-next
Diffstat (limited to 'kernel/workqueue.c')
| -rw-r--r-- | kernel/workqueue.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c06d131c2505..685e539dfe74 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -6520,6 +6520,30 @@ bool current_is_workqueue_rescuer(void) } /** + * current_is_workqueue_mem_reclaim - is %current a %WQ_MEM_RECLAIM worker? + * + * Determine whether %current is a workqueue worker executing on a workqueue + * created with %WQ_MEM_RECLAIM. This mirrors the condition that + * check_flush_dependency() warns on: flushing (or otherwise waiting on) a + * !WQ_MEM_RECLAIM workqueue from such a context breaks the forward-progress + * guarantee and can deadlock. Callers that may recurse into such a flush -- + * e.g. NFS LOCALIO submitting into a stacked filesystem that flushes its own + * !WQ_MEM_RECLAIM workqueue -- can use this to decide whether they must defer + * the work to a !WQ_MEM_RECLAIM workqueue rather than run it inline. + * + * Return: %true if %current is a %WQ_MEM_RECLAIM worker. %false otherwise. + */ +bool current_is_workqueue_mem_reclaim(void) +{ + struct worker *worker = current_wq_worker(); + + return worker && worker->current_pwq && + ((worker->current_pwq->wq->flags & + (WQ_MEM_RECLAIM | __WQ_LEGACY)) == WQ_MEM_RECLAIM); +} +EXPORT_SYMBOL_GPL(current_is_workqueue_mem_reclaim); + +/** * workqueue_congested - test whether a workqueue is congested * @cpu: CPU in question * @wq: target workqueue |
