For historical reasons, the worker attach/detach functions don't currently manage worker->pool and the callers are manually and inconsistently updating it. This patch moves worker->pool updates into the worker attach/detach functions. This makes worker->pool consistent and clearly defines how worker->pool updates are synchronized. This will help later workqueue visibility improvements by allowing safe access to workqueue information from worker->task.
Showing the changes to kernel/workqueue_internal.h (1 of 2 files). Show all
Unified · Split
| @@ -37,7 +37,7 @@ struct worker { · 36 unmodified lines | |||
| 37 | /* 64 bytes boundary on 64bit, 32 on 32bit */ | 37 | /* 64 bytes boundary on 64bit, 32 on 32bit */ |
| 38 | 38 | ||
| 39 | struct task_struct *task; /* I: worker task */ | 39 | struct task_struct *task; /* I: worker task */ |
| 40 | struct worker_pool *pool; /* I: the associated pool */ | 40 | struct worker_pool *pool; /* A: the associated pool */ |
| 41 | /* L: for rescuers */ | 41 | /* L: for rescuers */ |
| 42 | struct list_head node; /* A: anchored at pool->workers */ | 42 | struct list_head node; /* A: anchored at pool->workers */ |
| 43 | /* A: runs through worker->node */ | 43 | /* A: runs through worker->node */ |