Skip to content
  • Tejun Heo's avatar
    workqueue: drop @bind from create_worker() · bc2ae0f5
    Tejun Heo authored
    
    
    Currently, create_worker()'s callers are responsible for deciding
    whether the newly created worker should be bound to the associated CPU
    and create_worker() sets WORKER_UNBOUND only for the workers for the
    unbound global_cwq.  Creation during normal operation is always via
    maybe_create_worker() and @bind is true.  For workers created during
    hotplug, @bind is false.
    
    Normal operation path is planned to be used even while the CPU is
    going through hotplug operations or offline and this static decision
    won't work.
    
    Drop @bind from create_worker() and decide whether to bind by looking
    at GCWQ_DISASSOCIATED.  create_worker() will also set WORKER_UNBOUND
    autmatically if disassociated.  To avoid flipping GCWQ_DISASSOCIATED
    while create_worker() is in progress, the flag is now allowed to be
    changed only while holding all manager_mutexes on the global_cwq.
    
    This requires that GCWQ_DISASSOCIATED is not cleared behind trustee's
    back.  CPU_ONLINE no longer clears DISASSOCIATED before flushing
    trustee, which clears DISASSOCIATED before rebinding remaining workers
    if asked to release.  For cases where trustee isn't around, CPU_ONLINE
    clears DISASSOCIATED after flushing trustee.  Also, now, first_idle
    has UNBOUND set on creation which is explicitly cleared by CPU_ONLINE
    while binding it.  These convolutions will soon be removed by further
    simplification of CPU hotplug path.
    
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatar"Rafael J. Wysocki" <rjw@sisk.pl>
    bc2ae0f5