diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-11-02 23:26:41 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-11-02 23:26:41 +0100 |
commit | 4075409c9fcbc4b7967f2e92d808acc0b441d92e (patch) | |
tree | 4fec2a14de197bd7a59dd9d115a69eb6b5efbdbf /Documentation/core-api | |
parent | Merge tag 'xfs-5.16-merge-4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux (diff) | |
parent | workqueue: doc: Call out the non-reentrance conditions (diff) | |
download | linux-4075409c9fcbc4b7967f2e92d808acc0b441d92e.tar.xz linux-4075409c9fcbc4b7967f2e92d808acc0b441d92e.zip |
Merge branch 'for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue updates from Tejun Heo:
"Nothing too interesting. An optimization to short-circuit noop cpumask
updates, debug dump code reorg, and doc update"
* 'for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
workqueue: doc: Call out the non-reentrance conditions
workqueue: Introduce show_one_worker_pool and show_one_workqueue.
workqueue: make sysfs of unbound kworker cpumask more clever
Diffstat (limited to 'Documentation/core-api')
-rw-r--r-- | Documentation/core-api/workqueue.rst | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Documentation/core-api/workqueue.rst b/Documentation/core-api/workqueue.rst index 541d31de8926..3b22ed137662 100644 --- a/Documentation/core-api/workqueue.rst +++ b/Documentation/core-api/workqueue.rst @@ -216,10 +216,6 @@ resources, scheduled and executed. This flag is meaningless for unbound wq. -Note that the flag ``WQ_NON_REENTRANT`` no longer exists as all -workqueues are now non-reentrant - any work item is guaranteed to be -executed by at most one worker system-wide at any given time. - ``max_active`` -------------- @@ -391,6 +387,23 @@ the stack trace of the offending worker thread. :: The work item's function should be trivially visible in the stack trace. +Non-reentrance Conditions +========================= + +Workqueue guarantees that a work item cannot be re-entrant if the following +conditions hold after a work item gets queued: + + 1. The work function hasn't been changed. + 2. No one queues the work item to another workqueue. + 3. The work item hasn't been reinitiated. + +In other words, if the above conditions hold, the work item is guaranteed to be +executed by at most one worker system-wide at any given time. + +Note that requeuing the work item (to the same queue) in the self function +doesn't break these conditions, so it's safe to do. Otherwise, caution is +required when breaking the conditions inside a work function. + Kernel Inline Documentations Reference ====================================== |