Skip to content

Commit d70f5d5

Browse files
Lai Jiangshanhtejun
authored andcommitted
workqueue: Use list_last_entry() to get the last idle worker
It is clearer than open code. Signed-off-by: Lai Jiangshan <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent ae1296a commit d70f5d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/workqueue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,7 +2904,7 @@ static void idle_worker_timeout(struct timer_list *t)
29042904
unsigned long expires;
29052905

29062906
/* idle_list is kept in LIFO order, check the last one */
2907-
worker = list_entry(pool->idle_list.prev, struct worker, entry);
2907+
worker = list_last_entry(&pool->idle_list, struct worker, entry);
29082908
expires = worker->last_active + IDLE_WORKER_TIMEOUT;
29092909
do_cull = !time_before(jiffies, expires);
29102910

@@ -2946,7 +2946,7 @@ static void idle_cull_fn(struct work_struct *work)
29462946
struct worker *worker;
29472947
unsigned long expires;
29482948

2949-
worker = list_entry(pool->idle_list.prev, struct worker, entry);
2949+
worker = list_last_entry(&pool->idle_list, struct worker, entry);
29502950
expires = worker->last_active + IDLE_WORKER_TIMEOUT;
29512951

29522952
if (time_before(jiffies, expires)) {

0 commit comments

Comments
 (0)