Skip to content

Commit

Permalink
workqueue: use LIST_HEAD to initialize cull_list
Browse files Browse the repository at this point in the history
Use LIST_HEAD() to initialize cull_list instead of open-coding it.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Yang Yingliang authored and Tejun Heo committed Aug 7, 2023
1 parent ace3c54 commit 9680540
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -2304,9 +2304,8 @@ static void idle_worker_timeout(struct timer_list *t)
static void idle_cull_fn(struct work_struct *work)
{
struct worker_pool *pool = container_of(work, struct worker_pool, idle_cull_work);
struct list_head cull_list;
LIST_HEAD(cull_list);

INIT_LIST_HEAD(&cull_list);
/*
* Grabbing wq_pool_attach_mutex here ensures an already-running worker
* cannot proceed beyong worker_detach_from_pool() in its self-destruct
Expand Down Expand Up @@ -3872,10 +3871,8 @@ static void rcu_free_pool(struct rcu_head *rcu)
static void put_unbound_pool(struct worker_pool *pool)
{
DECLARE_COMPLETION_ONSTACK(detach_completion);
struct list_head cull_list;
struct worker *worker;

INIT_LIST_HEAD(&cull_list);
LIST_HEAD(cull_list);

lockdep_assert_held(&wq_pool_mutex);

Expand Down

0 comments on commit 9680540

Please sign in to comment.