summaryrefslogtreecommitdiffstats
path: root/kernel/workqueue_internal.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2023-05-17 17:02:08 -1000
committerTejun Heo <tj@kernel.org>2023-05-17 17:02:08 -1000
commitbdf8b9bfc131864f0fcef268b34123acfb6a1b59 (patch)
tree922fb9b2fb1234c3a4079b6be0ce75a2ecc5b6a6 /kernel/workqueue_internal.h
parentc54d5046a06b90adb3d1188f0741a88692854354 (diff)
downloadlinux-stable-bdf8b9bfc131864f0fcef268b34123acfb6a1b59.tar.gz
linux-stable-bdf8b9bfc131864f0fcef268b34123acfb6a1b59.tar.bz2
linux-stable-bdf8b9bfc131864f0fcef268b34123acfb6a1b59.zip
workqueue: Improve locking rule description for worker fields
* Some worker fields are modified only by the worker itself while holding pool->lock thus making them safe to read from self, IRQ context if the CPU is running the worker or while holding pool->lock. Add 'K' locking rule for them. * worker->sleeping is currently marked "None" which isn't very descriptive. It's used only by the worker itself. Add 'S' locking rule for it. A future patch will depend on the 'K' rule to access worker->current_* from the scheduler ticks. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue_internal.h')
-rw-r--r--kernel/workqueue_internal.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h
index 0600f04ceeb2..c2455be7b4c2 100644
--- a/kernel/workqueue_internal.h
+++ b/kernel/workqueue_internal.h
@@ -28,14 +28,15 @@ struct worker {
struct hlist_node hentry; /* L: while busy */
};
- struct work_struct *current_work; /* L: work being processed */
- work_func_t current_func; /* L: current_work's fn */
- struct pool_workqueue *current_pwq; /* L: current_work's pwq */
- unsigned int current_color; /* L: current_work's color */
- int sleeping; /* None */
+ struct work_struct *current_work; /* K: work being processed and its */
+ work_func_t current_func; /* K: function */
+ struct pool_workqueue *current_pwq; /* K: pwq */
+ unsigned int current_color; /* K: color */
+
+ int sleeping; /* S: is worker sleeping? */
/* used by the scheduler to determine a worker's last known identity */
- work_func_t last_func; /* L: last work's fn */
+ work_func_t last_func; /* K: last work's fn */
struct list_head scheduled; /* L: scheduled works */
@@ -45,7 +46,7 @@ struct worker {
struct list_head node; /* A: anchored at pool->workers */
/* A: runs through worker->node */
- unsigned long last_active; /* L: last active timestamp */
+ unsigned long last_active; /* K: last active timestamp */
unsigned int flags; /* X: flags */
int id; /* I: worker id */