History

workqueue: Remove clear_work_data()

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.

Tejun Heo committed 2 years ago

Commit afe928c1 parent 978b8401 file · +8 −16Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+8−16
@@ -763,10 +763,9 @@ static int work_next_color(int color) · 762 unmodified lines
763763 * contain the pointer to the queued pwq. Once execution starts, the flag
764764 * is cleared and the high bits contain OFFQ flags and pool ID.
765765 *
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.
770769 *
771770 * get_work_pool() and get_work_pwq() can be used to obtain the pool or pwq
772771 * 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
841840 smp_mb();
842841 }
843842
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−
850843 static inline struct pool_workqueue *work_struct_pwq(unsigned long data)
851844 {
852845 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
42174210 if (wq_online)
42184211 __flush_work(work, true);
42194212
4220− clear_work_data(work);
4221−
42224213 /*
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.
42264217 */
4227− smp_mb();
4218+ set_work_pool_and_clear_pending(work, WORK_OFFQ_POOL_NONE);
4219+
42284220 if (waitqueue_active(&wq_cancel_waitq))
42294221 __wake_up(&wq_cancel_waitq, TASK_NORMAL, 1, work);
42304222