[PATCH 3/4] workqueue: free wq->unbound_attrs earlier
From: Lai Jiangshan
Date: Fri May 29 2020 - 02:59:14 EST
wq->unbound_attrs is never accessed in rcu read site, so that
it can be freed earlier and relieves memory pressure earlier,
although slightly.
Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxxxxx>
---
kernel/workqueue.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 8d017727bfbc..c0cbe0de95d0 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3489,8 +3489,6 @@ static void rcu_free_wq(struct rcu_head *rcu)
if (!(wq->flags & WQ_UNBOUND))
free_percpu(wq->cpu_pwqs);
- else
- free_workqueue_attrs(wq->unbound_attrs);
kfree(wq);
}
@@ -3678,6 +3676,7 @@ static void pwq_unbound_release_workfn(struct work_struct *work)
*/
if (is_last) {
wq_unregister_lockdep(wq);
+ free_workqueue_attrs(wq->unbound_attrs);
call_rcu(&wq->rcu, rcu_free_wq);
}
}
--
2.20.1