• Tejun Heo's avatar
    workqueue: replace get_pwq() with explicit per_cpu_ptr() accesses and first_pwq() · 7fb98ea7
    Tejun Heo authored
    get_pwq() takes @cpu, which can also be WORK_CPU_UNBOUND, and @wq and
    returns the matching pwq (pool_workqueue).  We want to move away from
    using @cpu for identifying pools and pwqs for unbound pools with
    custom attributes and there is only one user - workqueue_congested() -
    which makes use of the WQ_UNBOUND conditional in get_pwq().  All other
    users already know whether they're dealing with a per-cpu or unbound
    workqueue.
    
    Replace get_pwq() with explicit per_cpu_ptr(wq->cpu_pwqs, cpu) for
    per-cpu workqueues and first_pwq() for unbound ones, and open-code
    WQ_UNBOUND conditional in workqueue_congested().
    
    Note that this makes workqueue_congested() behave sligntly differently
    when @cpu other than WORK_CPU_UNBOUND is specified.  It ignores @cpu
    for unbound workqueues and always uses the first pwq instead of
    oopsing.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Reviewed-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
    7fb98ea7
workqueue.c 103 KB