Skip to contentSkip to conversation

workqueue: replace open-coded work_pending()

PATCH Applied Julian Wiedmann 3 participants 5 messages Jun 2, 2021 – Jun 4, 2021 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 workqueue: replace open-coded work_pending()

Use the right helper to check whether a work item is currently pending.

---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/workqueue.c +1 -1
index 50142fc08902..8a700ccfa313 100644
@@ -3209,7 +3209,7 @@ EXPORT_SYMBOL(flush_delayed_work);
  */
 bool flush_rcu_work(struct rcu_work *rwork)
 {
-	if (test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&rwork->work))) {
+	if (work_pending(&rwork->work)) {
 		rcu_barrier();
 		flush_work(&rwork->work);
 		return true;
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 workqueue: clean up for_each_pwq()'s documentation

The if/else clause was removed with commit 5a6446626d7e ("workqueue: Convert for_each_wq to use built-in list check").

---
 kernel/workqueue.c | 3 ---
 1 file changed, 3 deletions(-)
kernel/workqueue.c +0 -3
index 8a700ccfa313..104e3ef04e33 100644
@@ -418,9 +418,6 @@ static void show_pwq(struct pool_workqueue *pwq);
  * This must be called either with wq->mutex held or RCU read locked.
  * If the pwq needs to be used beyond the locking in effect, the caller is
  * responsible for guaranteeing that the pwq stays online.
- *
- * The if/else clause exists only for the lockdep assertion and can be
- * ignored.
  */
 #define for_each_pwq(pwq, wq)						\
 	list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node,		\
Signature · 1 line
2.25.1
reviewer Reviewed-by on v1 1/2
#3 lore raw
In reply to Julian Wiedmann

For both of these patches

Quoted 24 lines · Julian Wiedmann

Use the right helper to check whether a work item is currently pending.

---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/workqueue.c +1 -2
index 50142fc08902..8a700ccfa313 100644
@@ -3209,7 +3209,7 @@ EXPORT_SYMBOL(flush_delayed_work);
  */
 bool flush_rcu_work(struct rcu_work *rwork)
 {
-       if (test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&rwork->work))) {
+       if (work_pending(&rwork->work)) {
                rcu_barrier();
                flush_work(&rwork->work);
                return true;
--

2.25.1

maintainer Applied
#2 lore raw

Re: [PATCH wq/for-next 2/2] workqueue: clean up for_each_pwq()'s documentation

In reply to Julian Wiedmann
Quoted 4 lines · Julian Wiedmann

The if/else clause was removed with commit 5a6446626d7e ("workqueue: Convert for_each_wq to use built-in list check").

Applied to wq/for-5.14.

Thakns.

Signature · 1 line
tejun