Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327164
b: refs/heads/master
c: 23657bb
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Aug 14, 2012
1 parent 72b20b5 commit 7b5dbae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 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: 1265057fa02c7bed3b6d9ddc8a2048065a370364
refs/heads/master: 23657bb192f14b789e4c478def8f11ecc95b4f6c
19 changes: 12 additions & 7 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,19 @@ static void set_work_cwq(struct work_struct *work,
static void set_work_cpu_and_clear_pending(struct work_struct *work,
unsigned int cpu)
{
/*
* The following wmb is paired with the implied mb in
* test_and_set_bit(PENDING) and ensures all updates to @work made
* here are visible to and precede any updates by the next PENDING
* owner.
*/
smp_wmb();
set_work_data(work, (unsigned long)cpu << WORK_OFFQ_CPU_SHIFT, 0);
}

static void clear_work_data(struct work_struct *work)
{
smp_wmb(); /* see set_work_cpu_and_clear_pending() */
set_work_data(work, WORK_STRUCT_NO_CPU, 0);
}

Expand Down Expand Up @@ -2182,14 +2190,11 @@ __acquires(&gcwq->lock)
wake_up_worker(pool);

/*
* Record the last CPU and clear PENDING. The following wmb is
* paired with the implied mb in test_and_set_bit(PENDING) and
* ensures all updates to @work made here are visible to and
* precede any updates by the next PENDING owner. Also, clear
* PENDING inside @gcwq->lock so that PENDING and queued state
* changes happen together while IRQ is disabled.
* Record the last CPU and clear PENDING which should be the last
* update to @work. Also, do this inside @gcwq->lock so that
* PENDING and queued state changes happen together while IRQ is
* disabled.
*/
smp_wmb();
set_work_cpu_and_clear_pending(work, gcwq->cpu);

spin_unlock_irq(&gcwq->lock);
Expand Down

0 comments on commit 7b5dbae

Please sign in to comment.