History

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.

Lai Jiangshan committed 12 years ago

Commit 1037de31 parent cafebac1 file · +5 −5Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+5−5
@@ -773,8 +773,8 @@ static bool too_many_workers(struct worker_pool *pool) · 772 unmodified lines
773 * Wake up functions.773 * Wake up functions.
774 */774 */
775 775
776/* Return the first worker. Safe with preemption disabled */776/* Return the first idle worker. Safe with preemption disabled */
777static struct worker *first_worker(struct worker_pool *pool)777static struct worker *first_idle_worker(struct worker_pool *pool)
778{778{
779 if (unlikely(list_empty(&pool->idle_list)))779 if (unlikely(list_empty(&pool->idle_list)))
780 return NULL;780 return NULL;
@@ -793,7 +793,7 @@ static struct worker *first_worker(struct worker_pool *pool) · 12 unmodified lines
793 */793 */
794static void wake_up_worker(struct worker_pool *pool)794static void wake_up_worker(struct worker_pool *pool)
795{795{
796 struct worker *worker = first_worker(pool);796 struct worker *worker = first_idle_worker(pool);
797 797
798 if (likely(worker))798 if (likely(worker))
799 wake_up_process(worker->task);799 wake_up_process(worker->task);
@@ -867,7 +867,7 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu) · 67 unmodified lines
867 */867 */
868 if (atomic_dec_and_test(&pool->nr_running) &&868 if (atomic_dec_and_test(&pool->nr_running) &&
869 !list_empty(&pool->worklist))869 !list_empty(&pool->worklist))
870 to_wakeup = first_worker(pool);870 to_wakeup = first_idle_worker(pool);
871 return to_wakeup ? to_wakeup->task : NULL;871 return to_wakeup ? to_wakeup->task : NULL;
872}872}
873 873
@@ -3475,7 +3475,7 @@ static void put_unbound_pool(struct worker_pool *pool) · 2601 unmodified lines
3475 mutex_lock(&pool->manager_arb);3475 mutex_lock(&pool->manager_arb);
3476 3476
3477 spin_lock_irq(&pool->lock);3477 spin_lock_irq(&pool->lock);
3478 while ((worker = first_worker(pool)))3478 while ((worker = first_idle_worker(pool)))
3479 destroy_worker(worker);3479 destroy_worker(worker);
3480 WARN_ON(pool->nr_workers || pool->nr_idle);3480 WARN_ON(pool->nr_workers || pool->nr_idle);
3481 spin_unlock_irq(&pool->lock);3481 spin_unlock_irq(&pool->lock);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t