clear_work_data() is only used in one place and immediately followed by smp_mb(), making it equivalent to set_work_pool_and_clear_pending() w/ WORK_OFFQ_POOL_NONE for @pool_id. Drop it. No functional changes.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -763,10 +763,9 @@ static int work_next_color(int color) · 762 unmodified lines | ||
| 763 | 763 | * contain the pointer to the queued pwq. Once execution starts, the flag |
| 764 | 764 | * is cleared and the high bits contain OFFQ flags and pool ID. |
| 765 | 765 | * |
| 766 | − * set_work_pwq(), set_work_pool_and_clear_pending(), mark_work_canceling() | |
| 767 | − * and clear_work_data() can be used to set the pwq, pool or clear | |
| 768 | − * work->data. These functions should only be called while the work is | |
| 769 | − * owned - ie. while the PENDING bit is set. | |
| 766 | + * set_work_pwq(), set_work_pool_and_clear_pending() and mark_work_canceling() | |
| 767 | + * can be used to set the pwq, pool or clear work->data. These functions should | |
| 768 | + * only be called while the work is owned - ie. while the PENDING bit is set. | |
| 770 | 769 | * |
| 771 | 770 | * get_work_pool() and get_work_pwq() can be used to obtain the pool or pwq |
| 772 | 771 | * corresponding to a work. Pool is available once the work has been |
| @@ -841,12 +840,6 @@ static void set_work_pool_and_clear_pending(struct work_struct *work, · 68 unmodified lines | ||
| 841 | 840 | smp_mb(); |
| 842 | 841 | } |
| 843 | 842 | |
| 844 | −static void clear_work_data(struct work_struct *work) | |
| 845 | −{ | |
| 846 | − smp_wmb(); /* see set_work_pool_and_clear_pending() */ | |
| 847 | − set_work_data(work, WORK_STRUCT_NO_POOL, 0); | |
| 848 | −} | |
| 849 | − | |
| 850 | 843 | static inline struct pool_workqueue *work_struct_pwq(unsigned long data) |
| 851 | 844 | { |
| 852 | 845 | return (struct pool_workqueue *)(data & WORK_STRUCT_PWQ_MASK); |
| @@ -4217,14 +4210,13 @@ static bool __cancel_work_sync(struct work_struct *work, u32 cflags) · 3364 unmodified lines | ||
| 4217 | 4210 | if (wq_online) |
| 4218 | 4211 | __flush_work(work, true); |
| 4219 | 4212 | |
| 4220 | − clear_work_data(work); | |
| 4221 | − | |
| 4222 | 4213 | /* |
| 4223 | − * Paired with prepare_to_wait() above so that either | |
| 4224 | − * waitqueue_active() is visible here or !work_is_canceling() is | |
| 4225 | − * visible there. | |
| 4214 | + * smp_mb() at the end of set_work_pool_and_clear_pending() is paired | |
| 4215 | + * with prepare_to_wait() above so that either waitqueue_active() is | |
| 4216 | + * visible here or !work_is_canceling() is visible there. | |
| 4226 | 4217 | */ |
| 4227 | − smp_mb(); | |
| 4218 | + set_work_pool_and_clear_pending(work, WORK_OFFQ_POOL_NONE); | |
| 4219 | + | |
| 4228 | 4220 | if (waitqueue_active(&wq_cancel_waitq)) |
| 4229 | 4221 | __wake_up(&wq_cancel_waitq, TASK_NORMAL, 1, work); |
| 4230 | 4222 | |