summaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorLai Jiangshan <jiangshan.ljs@antgroup.com>2024-03-08 17:42:53 +0800
committerTejun Heo <tj@kernel.org>2024-03-25 09:12:24 -1000
commitd70f5d5778e88addcc3e56858d5e9c635c1e420e (patch)
tree9345153f6af5a76fe1e8d8a36a76a5eaceed3c59 /kernel/workqueue.c
parentae1296a7bfe4f8e446677ccb761d9419926557bc (diff)
workqueue: Use list_last_entry() to get the last idle worker
It is clearer than open code. Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index f03960f094fa..d1ccc3d05b7a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2904,7 +2904,7 @@ static void idle_worker_timeout(struct timer_list *t)
unsigned long expires;
/* idle_list is kept in LIFO order, check the last one */
- worker = list_entry(pool->idle_list.prev, struct worker, entry);
+ worker = list_last_entry(&pool->idle_list, struct worker, entry);
expires = worker->last_active + IDLE_WORKER_TIMEOUT;
do_cull = !time_before(jiffies, expires);
@@ -2946,7 +2946,7 @@ static void idle_cull_fn(struct work_struct *work)
struct worker *worker;
unsigned long expires;
- worker = list_entry(pool->idle_list.prev, struct worker, entry);
+ worker = list_last_entry(&pool->idle_list, struct worker, entry);
expires = worker->last_active + IDLE_WORKER_TIMEOUT;
if (time_before(jiffies, expires)) {