Re: [patch 4/4] sched: Distangle worker accounting from rq->lock

Thomas Gleixner
2011-06-22T19:30:13Z

On Wed, 22 Jun 2011, Thomas Gleixner wrote:
> +void wq_worker_sleeping(struct task_struct *task)
> {
> - struct worker *worker = kthread_data(task), *to_wakeup = NULL;
> - struct global_cwq *gcwq = get_gcwq(cpu);
> - atomic_t *nr_running = get_gcwq_nr_running(cpu);
> + struct worker *worker = kthread_data(task);
> + struct global_cwq *gcwq;
> + int cpu;
>
> if (worker->flags & WORKER_NOT_RUNNING)
> - return NULL;
> + return;
>
> - /* this can only happen on the local cpu */
> - BUG_ON(cpu != raw_smp_processor_id());
> + if (WARN_ON_ONCE(worker->sleeping))
> + return;

Darn, forgot to add

worker->sleeping = 1;

back when I added the WARN_ON.