Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350302
b: refs/heads/master
c: 8d03ecf
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Feb 14, 2013
1 parent 92b7b9e commit 63797c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1dd638149f1f9d7d7dbb32591d5c7c2a0ea36264
refs/heads/master: 8d03ecfe471802d6afe97da97722b6924533aa82
33 changes: 8 additions & 25 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1159,35 +1159,18 @@ static void insert_work(struct cpu_workqueue_struct *cwq,

/*
* Test whether @work is being queued from another work executing on the
* same workqueue. This is rather expensive and should only be used from
* cold paths.
* same workqueue.
*/
static bool is_chained_work(struct workqueue_struct *wq)
{
unsigned long flags;
unsigned int cpu;

for_each_cwq_cpu(cpu, wq) {
struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
struct worker_pool *pool = cwq->pool;
struct worker *worker;
struct hlist_node *pos;
int i;
struct worker *worker;

spin_lock_irqsave(&pool->lock, flags);
for_each_busy_worker(worker, i, pos, pool) {
if (worker->task != current)
continue;
spin_unlock_irqrestore(&pool->lock, flags);
/*
* I'm @worker, no locking necessary. See if @work
* is headed to the same workqueue.
*/
return worker->current_cwq->wq == wq;
}
spin_unlock_irqrestore(&pool->lock, flags);
}
return false;
worker = current_wq_worker();
/*
* Return %true iff I'm a worker execuing a work item on @wq. If
* I'm @worker, it's safe to dereference it without locking.
*/
return worker && worker->current_cwq->wq == wq;
}

static void __queue_work(unsigned int cpu, struct workqueue_struct *wq,
Expand Down

0 comments on commit 63797c3

Please sign in to comment.