Re: [PATCH 13/13] workqueue: record global worker ID instead of poolID in work->data when off-queue

From: Tejun Heo
Date: Mon Feb 04 2013 - 16:41:07 EST


Hello,

On Fri, Feb 01, 2013 at 02:41:36AM +0800, Lai Jiangshan wrote:
> - pool = worker_pool_by_id(pool_id);
> - if (!pool)
> - return NULL;
> + rcu_read_lock();
> + exec = idr_find(&worker_gwid_idr, worker_gwid);
>
> - spin_lock(&pool->lock);
> - exec = find_worker_executing_work(pool, work);
> if (exec) {
> - BUG_ON(pool != exec->pool);
> - *worker = exec;
> - return pool;
> + pool = exec->pool;
> + spin_lock(&pool->lock);
> + if (exec->current_work == work &&
> + exec->current_func == work->func) {
> + *worker = exec;
> + rcu_read_unlock();
> + return pool;
> + }
> + spin_unlock(&pool->lock);
> }
> - spin_unlock(&pool->lock);
> + rcu_read_unlock();

We're guaranteed to have irq disabled, why not use sched_rcu in
combination with synchronize_sched()?

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/