[lkml]   [2012]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 25/25] ipc: don't use [delayed_]work_pending()
On Mon, Dec 24, 2012 at 07:29:14PM -0800, Tejun Heo wrote:
> The behavior is primarily because we want to enable workqueue users
> to guarantee that a full work item execution happens at least once
> after certain event happens. ie. Let's say there's a work item which
> processes data generated by a device. If it's IRQ handler calls
> queue_work() after getting notified of new data segment by the device,
> it would want to guarantee that whole work item execution would happen
> afterwards. If you clear PENDING after execution, the event may
> overlap with the end of the previous execution and the new data won't
> be processed.

Oh, ok, I didn't realize we did some sort of a one-shot queueing - I
thought users of wq are supposed to be polling PENDING and when it is
cleared, they queue. But come to think of it, we can't be doing that in
an IRQ handler.

[ … ]

> It doesn't have anything to do with memory hotplug event itself. It's
> a generic memory access ordering / synchronization issue. There just
> isn't anything preventing test_bit() from seeing PENDING bit from
> before clearing.

That's true. So is it that the whole PENDING bit testing was actually
the wrong sync primitive to use in most cases and we actually really
needed to disable interrupts around testing of that bit?

Which would make your patches actually bugfixes.

/me goes and rereads 0/25 announcement mail.

Yes, it sounds like [delayed_]work_pending() needs to go or at least
needs a big fat comment over it explaining that it is a special, cheaper
alternative to be used *only* in conjunction with other synchronization.

Ok, thanks Tejun, for taking the time and explaining it again to me.


Sent from a fat crate under my desk. Formatting is fine.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2012-12-25 12:21    [W:0.065 / U:1.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site