• Oleg Nesterov's avatar
    workqueues: shrink cpu_populated_map when CPU dies · 00dfcaf7
    Oleg Nesterov authored
    When cpu_populated_map was introduced, it was supposed that cwq->thread can
    survive after CPU_DEAD, that is why we never shrink cpu_populated_map.
    
    This is not very nice, we can safely remove the already dead CPU from the map.
     The only required change is that destroy_workqueue() must hold the hotplug
    lock until it destroys all cwq->thread's, to protect the cpu_populated_map.
    We could make the local copy of cpu mask and drop the lock, but
    sizeof(cpumask_t) may be very large.
    
    Also, fix the comment near queue_work().  Unless _cpu_down() happens we do
    guarantee the cpu-affinity of the work_struct, and we have users which rely on
    this.
    
    [akpm@linux-foundation.org: repair comment]
    Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    00dfcaf7
workqueue.c 21.8 KB