mirror of
https://github.com/torvalds/linux
synced 2024-09-28 23:41:21 +00:00
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>
This commit is contained in:
parent
ae1296a7bf
commit
d70f5d5778
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue