• Oleg Nesterov's avatar
    simplify cleanup_workqueue_thread() · 14441960
    Oleg Nesterov authored
    cleanup_workqueue_thread() and cwq_should_stop() are overcomplicated.
    
    Convert the code to use kthread_should_stop/kthread_stop as was
    suggested by Gautham and Srivatsa.
    
    In particular this patch removes the (unlikely) busy-wait loop from the
    exit path, it was a temporary and ugly kludge (if not a bug).
    
    Note: the current code was designed to solve another old problem:
    work->func can't share locks with hotplug callbacks.  I think this could
    be done, see
    
    	http://marc.info/?l=linux-kernel&m=116905366428633
    
    but this needs some more complications to preserve CPU affinity of
    cwq->thread during cpu_up().  A freezer-based hotplug looks more
    appealing.
    
    [akpm@linux-foundation.org: make it more tolerant of gcc borkenness]
    Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
    Cc: Zilvinas Valinskas <zilvinas@wilibox.com>
    Cc: Gautham R Shenoy <ego@in.ibm.com>
    Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
    Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    14441960
workqueue.c 20.4 KB