Commit 1037de36 authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Tejun Heo

workqueue: rename first_worker() to first_idle_worker()

first_worker() actually returns the first idle workers, the name
first_idle_worker() which is self-commnet will be better.

All the callers of first_worker() expect it returns an idle worker,
the name first_idle_worker() with "idle" notation makes reviewers happier.
Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent cafebac1
...@@ -773,8 +773,8 @@ static bool too_many_workers(struct worker_pool *pool) ...@@ -773,8 +773,8 @@ static bool too_many_workers(struct worker_pool *pool)
* Wake up functions. * Wake up functions.
*/ */
/* Return the first worker. Safe with preemption disabled */ /* Return the first idle worker. Safe with preemption disabled */
static struct worker *first_worker(struct worker_pool *pool) static struct worker *first_idle_worker(struct worker_pool *pool)
{ {
if (unlikely(list_empty(&pool->idle_list))) if (unlikely(list_empty(&pool->idle_list)))
return NULL; return NULL;
...@@ -793,7 +793,7 @@ static struct worker *first_worker(struct worker_pool *pool) ...@@ -793,7 +793,7 @@ static struct worker *first_worker(struct worker_pool *pool)
*/ */
static void wake_up_worker(struct worker_pool *pool) static void wake_up_worker(struct worker_pool *pool)
{ {
struct worker *worker = first_worker(pool); struct worker *worker = first_idle_worker(pool);
if (likely(worker)) if (likely(worker))
wake_up_process(worker->task); wake_up_process(worker->task);
...@@ -867,7 +867,7 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu) ...@@ -867,7 +867,7 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu)
*/ */
if (atomic_dec_and_test(&pool->nr_running) && if (atomic_dec_and_test(&pool->nr_running) &&
!list_empty(&pool->worklist)) !list_empty(&pool->worklist))
to_wakeup = first_worker(pool); to_wakeup = first_idle_worker(pool);
return to_wakeup ? to_wakeup->task : NULL; return to_wakeup ? to_wakeup->task : NULL;
} }
...@@ -3475,7 +3475,7 @@ static void put_unbound_pool(struct worker_pool *pool) ...@@ -3475,7 +3475,7 @@ static void put_unbound_pool(struct worker_pool *pool)
mutex_lock(&pool->manager_arb); mutex_lock(&pool->manager_arb);
spin_lock_irq(&pool->lock); spin_lock_irq(&pool->lock);
while ((worker = first_worker(pool))) while ((worker = first_idle_worker(pool)))
destroy_worker(worker); destroy_worker(worker);
WARN_ON(pool->nr_workers || pool->nr_idle); WARN_ON(pool->nr_workers || pool->nr_idle);
spin_unlock_irq(&pool->lock); spin_unlock_irq(&pool->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment