lkml.org 
[lkml]   [2010]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCHSET] workqueue: implement and use WQ_UNBOUND
    Hello,

    On 07/21/2010 03:08 PM, David Howells wrote:
    > Tejun Heo <tj@kernel.org> wrote:
    >
    >> As all unbound works are served by the same gcwq, non reentrancy is
    >> automatically guaranteed.
    >
    > That doesn't actually explain _how_ it's non-reentrant. The gcwq includes a
    > collection of threads that can execute from it, right? If so, what mechanism
    > prevents two threads from executing the same work item, if that work item
    > isn't bound to a CPU? I've been trying to figure this out from the code, but
    > I don't see it offhand.

    Sharing the same gcwq is why workqueues bound to one CPU have
    non-reentrancy, so they're using the same mechanism. If it doesn't
    work for unbound workqueues, the normal ones are broken too. Each
    gcwq keeps track of currently running works in a hash table and looks
    whether the work in question is already executing before starting
    executing it. It's a bit complex but as a work_struct may be freed
    once execution starts, the status needs to be tracked outside.

    >>> Btw, how does this fare in an RT system, where work items bound to a CPU
    >>> can't get executed because their CPU is busy with an RT thread, even
    >>> though there are other, idle CPUs?
    >>
    >> Sure, there's nothing special about unbound workers. They're just normal
    >> kthreads.
    >
    > I should've been clearer: As I understand it, normal (unbound) worker items
    > are bound to the CPU on which they were queued, and will be executed there
    > only (barring CPU removal). If that's the case, isn't it possible that work
    > items can be prevented from getting execution time by an RT thread that's
    > hogging a CPU and won't let go?

    Yeah, for bound workqueues, sure. That's exactly the same as the
    original workqueue implementation. For unbound workqueues, it doesn't
    matter.

    Thanks.

    --
    tejun


    \
     
     \ /
      Last update: 2010-07-21 17:03    [W:0.022 / U:29.772 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site