In 75ccf5950f82 ("workqueue: prepare flush_workqueue() for dynamic creation and destrucion of unbound pool_workqueues"), a comment about the synchronization for the pwq in pwq_unbound_release_workfn() was added. The comment claimed the flush_mutex wasn't strictly necessary, it was correct in that time, due to the pwq was protected by workqueue_lock. But it is incorrect now since the wq->flush_mutex was renamed to wq->mutex and workqueue_lock was removed, the wq->mutex is strictly needed. But the comment was miss-updated when the synchronization was changed. This patch removes the incorrect comments and doesn't add any new comment to explain why wq->mutex is needed here, which is definitely obvious and wq->pwqs_node has "WQ" notation in its definition which is better comment. The old commit mentioned above also introduced a comment in link_pwq() about the synchronization. This comment is also removed in this patch since the whole link_pwq() is proteced by wq->mutex.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -3530,11 +3530,6 @@ static void pwq_unbound_release_workfn(struct work_struct *work) · 3529 unmodified lines | |||
| 3530 | if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND))) | 3530 | if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND))) |
| 3531 | return; | 3531 | return; |
| 3532 | 3532 | ||
| 3533 | /* | ||
| 3534 | * Unlink @pwq. Synchronization against wq->mutex isn't strictly | ||
| 3535 | * necessary on release but do it anyway. It's easier to verify | ||
| 3536 | * and consistent with the linking path. | ||
| 3537 | */ | ||
| 3538 | mutex_lock(&wq->mutex); | 3533 | mutex_lock(&wq->mutex); |
| 3539 | list_del_rcu(&pwq->pwqs_node); | 3534 | list_del_rcu(&pwq->pwqs_node); |
| 3540 | is_last = list_empty(&wq->pwqs); | 3535 | is_last = list_empty(&wq->pwqs); |
| @@ -3631,10 +3626,7 @@ static void link_pwq(struct pool_workqueue *pwq) · 90 unmodified lines | |||
| 3631 | if (!list_empty(&pwq->pwqs_node)) | 3626 | if (!list_empty(&pwq->pwqs_node)) |
| 3632 | return; | 3627 | return; |
| 3633 | 3628 | ||
| 3634 | /* | 3629 | /* set the matching work_color */ |
| 3635 | * Set the matching work_color. This is synchronized with | ||
| 3636 | * wq->mutex to avoid confusing flush_workqueue(). | ||
| 3637 | */ | ||
| 3638 | pwq->work_color = wq->work_color; | 3630 | pwq->work_color = wq->work_color; |
| 3639 | 3631 | ||
| 3640 | /* sync max_active to the current setting */ | 3632 | /* sync max_active to the current setting */ |