• Tejun Heo's avatar
    workqueue: restore CPU affinity of unbound workers on CPU_ONLINE · 7dbc725e
    Tejun Heo authored
    With the recent addition of the custom attributes support, unbound
    pools may have allowed cpumask which isn't full.  As long as some of
    CPUs in the cpumask are online, its workers will maintain cpus_allowed
    as set on worker creation; however, once no online CPU is left in
    cpus_allowed, the scheduler will reset cpus_allowed of any workers
    which get scheduled so that they can execute.
    
    To remain compliant to the user-specified configuration, CPU affinity
    needs to be restored when a CPU becomes online for an unbound pool
    which doesn't currently have any online CPUs before.
    
    This patch implement restore_unbound_workers_cpumask(), which is
    called from CPU_ONLINE for all unbound pools, checks whether the
    coming up CPU is the first allowed online one, and, if so, invokes
    set_cpus_allowed_ptr() with the configured cpumask on all workers.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Reviewed-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
    7dbc725e
workqueue.c 122 KB