lkml.org 
[lkml]   [2013]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2013-02-04 23:24    [W:0.212 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site