Skip to contentSkip to conversation

workqueue: replace call_rcu with kfree_rcu

PATCH New Zqiang 1 participant 1 message Oct 14, 2020 Workqueue

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH 1/1 workqueue: replace call_rcu with kfree_rcu

The pwq's rcu callback func only to release 'pwq' resources, can use 'kfree_rcu' instead of 'call_rcu' func.

---
 kernel/workqueue.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
kernel/workqueue.c +1 -6
index ac088ce6059b..8d4fe649631a 100644
@@ -3653,11 +3653,6 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs)
 	return NULL;
 }
 
-static void rcu_free_pwq(struct rcu_head *rcu)
-{
-	kmem_cache_free(pwq_cache,
-			container_of(rcu, struct pool_workqueue, rcu));
-}
 
 /*
  * Scheduled on system_wq by put_pwq() when an unbound pwq hits zero refcnt
@@ -3683,7 +3678,7 @@ static void pwq_unbound_release_workfn(struct work_struct *work)
 	put_unbound_pool(pool);
 	mutex_unlock(&wq_pool_mutex);
 
-	call_rcu(&pwq->rcu, rcu_free_pwq);
+	kfree_rcu(pwq, rcu);
 
 	/*
 	 * If we're the last pwq going away, @wq is already dead and no one
Signature · 1 line
2.17.1