[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130204214057.GG27963@mtj.dyndns.org>
Date: Mon, 4 Feb 2013 13:40:57 -0800
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 13/13] workqueue: record global worker ID instead of pool
ID in work->data when off-queue
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists