[lkml]   [2011]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH] workqueue: Restore cpus_allowed mask for sleeping workqueue rescue threads
    Rescuer threads may be migrated (and are bound) to particular CPUs when
    active. However, the allowed_cpus mask is not restored when they return
    to sleep rendering inconsistent the presented and actual set of CPUs the
    process may potentially run on. This patch fixes this oversight by
    recording the allowed_cpus mask for rescuer threads when it enters the
    rescuer_thread() main loop and restoring it every time the thread sleeps.

    v2: Heeded Peter Zijlstra's comments and don't allocate cpumask_t on
    stack, manipulate task cpus_allowed struct directly instead

    Signed-off-by: Ripduman Sohan <>
    kernel/workqueue.c | 6 ++++++
    1 files changed, 6 insertions(+), 0 deletions(-)

    diff --git a/kernel/workqueue.c b/kernel/workqueue.c
    index 25fb1b0..29d2ddf 100644
    --- a/kernel/workqueue.c
    +++ b/kernel/workqueue.c
    @@ -2078,6 +2078,12 @@ repeat:

    + if (is_unbound)
    + cpumask_setall(&current->cpus_allowed);
    + else
    + for_each_cwq_cpu(cpu, wq)
    + cpu_set(cpu, current->cpus_allowed);
    goto repeat;

     \ /
      Last update: 2011-09-01 15:39    [W:0.039 / U:30.092 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site