Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349828
b: refs/heads/master
c: e0bbe2d
h: refs/heads/master
v: v3
  • Loading branch information
Frederic Weisbecker committed Nov 14, 2012
1 parent 473cd68 commit 042647e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 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: c8446b75be6f85b3d40066922876cb7adc948afb
refs/heads/master: e0bbe2d80c415bd4063d894ec2ccb336788af814
16 changes: 11 additions & 5 deletions trunk/kernel/irq_work.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,21 @@ static DEFINE_PER_CPU(struct llist_head, irq_work_list);
*/
static bool irq_work_claim(struct irq_work *work)
{
unsigned long flags, nflags;
unsigned long flags, oflags, nflags;

/*
* Start with our best wish as a premise but only trust any
* flag value after cmpxchg() result.
*/
flags = work->flags & ~IRQ_WORK_PENDING;
for (;;) {
flags = work->flags;
if (flags & IRQ_WORK_PENDING)
return false;
nflags = flags | IRQ_WORK_FLAGS;
if (cmpxchg(&work->flags, flags, nflags) == flags)
oflags = cmpxchg(&work->flags, flags, nflags);
if (oflags == flags)
break;
if (oflags & IRQ_WORK_PENDING)
return false;
flags = oflags;
cpu_relax();
}

Expand Down

0 comments on commit 042647e

Please sign in to comment.