• Tejun Heo's avatar
    workqueue: Drop the special locking rule for worker->flags and worker_pool->flags · bc8b50c2
    Tejun Heo authored
    worker->flags used to be accessed from scheduler hooks without grabbing
    pool->lock for concurrency management. This is no longer true since
    6d25be57 ("sched/core, workqueues: Distangle worker accounting from rq
    lock"). Also, it's unclear why worker_pool->flags was using the "X" rule.
    All relevant users are accessing it under the pool lock.
    
    Let's drop the special "X" rule and use the "L" rule for these flag fields
    instead. While at it, replace the CONTEXT comment with
    lockdep_assert_held().
    
    This allows worker_set/clr_flags() to be used from context which isn't the
    worker itself. This will be used later to implement assinging work items to
    workers before waking them up so that workqueue can have better control over
    which worker executes which work item on which CPU.
    
    The only actual changes are sanity checks. There shouldn't be any visible
    behavior changes.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    bc8b50c2
workqueue.c 183 KB