History

workqueue: use %current instead of worker->task in worker_maybe_bind_and_lock()

worker_maybe_bind_and_lock() uses both @worker->task and @current at the same time. As worker_maybe_bind_and_lock() can only be called by the current worker task, they are always the same. Update worker_maybe_bind_and_lock() to use %current consistently. This doesn't introduce any functional change. tj: Massaged the description.

Lai Jiangshan committed 13 years ago

Commit f5faa071 parent 45d95501 file · +3 −4Browse files

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

Unified · Split

kernel/workqueue.c+3−4
@@ -1512,7 +1512,7 @@ static void worker_leave_idle(struct worker *worker) · 1511 unmodified lines
15121512 * flushed from cpu callbacks while cpu is going down, they are
15131513 * guaranteed to execute on the cpu.
15141514 *
1515− * This function is to be used by rogue workers and rescuers to bind
1515+ * This function is to be used by unbound workers and rescuers to bind
15161516 * themselves to the target cpu and may race with cpu going down or
15171517 * coming online. kthread_bind() can't be used because it may put the
15181518 * worker to already dead cpu and set_cpus_allowed_ptr() can't be used
@@ -1537,7 +1537,6 @@ static bool worker_maybe_bind_and_lock(struct worker *worker) · 18 unmodified lines
15371537 __acquires(&pool->lock)
15381538 {
15391539 struct worker_pool *pool = worker->pool;
1540− struct task_struct *task = worker->task;
15411540
15421541 while (true) {
15431542 /*
@@ -1547,12 +1546,12 @@ __acquires(&pool->lock) · 3 unmodified lines
15471546 * against POOL_DISASSOCIATED.
15481547 */
15491548 if (!(pool->flags & POOL_DISASSOCIATED))
1550− set_cpus_allowed_ptr(task, get_cpu_mask(pool->cpu));
1549+ set_cpus_allowed_ptr(current, get_cpu_mask(pool->cpu));
15511550
15521551 spin_lock_irq(&pool->lock);
15531552 if (pool->flags & POOL_DISASSOCIATED)
15541553 return false;
1555− if (task_cpu(task) == pool->cpu &&
1554+ if (task_cpu(current) == pool->cpu &&
15561555 cpumask_equal(&current->cpus_allowed,
15571556 get_cpu_mask(pool->cpu)))
15581557 return true;