Messages in this thread | | | Date | Wed, 31 Oct 2012 14:32:33 +0100 | Subject | Re: [PATCH 2/2] irq_work: Fix racy IRQ_WORK_BUSY flag setting | From | Frederic Weisbecker <> |
| |
2012/10/31 Steven Rostedt <rostedt@goodmis.org>: > On Wed, 2012-10-31 at 20:04 +0900, anish kumar wrote: >> nflags = 1 | 3 >> nflags = 2 | 3 >> In both cases the result would be same.If I am right then wouldn't this >> operation be redundant? > > Right. Actually we could change the new loop to: > > for (;;) { > oflags = cmpxchg(&work->flags, flags, IRQ_WORK_FLAGS); > if (oflags == flags) > break; > if (oflags & IRQ_WORK_PENDING) > return false; > flags = oflags; > cpu_relax(); > }
We could. But I wanted to keep the code able to handle new flags in the future (such as IRQ_WORK_LAZY).
> Frederic, > > Would you like to add my explanation to your change log? You can add the > entire thing, which I think would explain a lot to people.
It's indeed a very clear explanation. I'll put that in the changelog, thanks!
| |