lkml.org 
[lkml]   [2012]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH RT 8/9][RFC] [PATCH 8/9] workqueue: Revert workqueue: Fix PF_THREAD_BOUND abuse
    Revert commit

    Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Date: Mon Oct 3 12:43:25 2011 +0200
    workqueue: Fix PF_THREAD_BOUND abuse

    As TREAD_BOUND no longer affects cpu down, and this code introduced
    a lot of races with taking down a CPU.

    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    ---
    kernel/workqueue.c | 29 +++++++++--------------------
    1 files changed, 9 insertions(+), 20 deletions(-)

    diff --git a/kernel/workqueue.c b/kernel/workqueue.c
    index e7f3e79..3b53135 100644
    --- a/kernel/workqueue.c
    +++ b/kernel/workqueue.c
    @@ -1286,14 +1286,8 @@ __acquires(&gcwq->lock)
    return false;
    if (task_cpu(task) == gcwq->cpu &&
    cpumask_equal(&current->cpus_allowed,
    - get_cpu_mask(gcwq->cpu))) {
    - /*
    - * Since we're binding to a particular cpu and need to
    - * stay there for correctness, mark us PF_THREAD_BOUND.
    - */
    - task->flags |= PF_THREAD_BOUND;
    + get_cpu_mask(gcwq->cpu)))
    return true;
    - }
    spin_unlock_irq(&gcwq->lock);

    /*
    @@ -1307,18 +1301,6 @@ __acquires(&gcwq->lock)
    }
    }

    -static void worker_unbind_and_unlock(struct worker *worker)
    -{
    - struct global_cwq *gcwq = worker->gcwq;
    - struct task_struct *task = worker->task;
    -
    - /*
    - * Its no longer required we're PF_THREAD_BOUND, the work is done.
    - */
    - task->flags &= ~PF_THREAD_BOUND;
    - spin_unlock_irq(&gcwq->lock);
    -}
    -
    static struct worker *alloc_worker(void)
    {
    struct worker *worker;
    @@ -1381,9 +1363,15 @@ static struct worker *create_worker(struct global_cwq *gcwq, bool bind)
    if (IS_ERR(worker->task))
    goto fail;

    + /*
    + * A rogue worker will become a regular one if CPU comes
    + * online later on. Make sure every worker has
    + * PF_THREAD_BOUND set.
    + */
    if (bind && !on_unbound_cpu)
    kthread_bind(worker->task, gcwq->cpu);
    else {
    + worker->task->flags |= PF_THREAD_BOUND;
    if (on_unbound_cpu)
    worker->flags |= WORKER_UNBOUND;
    }
    @@ -2060,7 +2048,7 @@ repeat:
    if (keep_working(gcwq))
    wake_up_worker(gcwq);

    - worker_unbind_and_unlock(rescuer);
    + spin_unlock_irq(&gcwq->lock);
    }

    schedule();
    @@ -3009,6 +2997,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *name,
    if (IS_ERR(rescuer->task))
    goto err;

    + rescuer->task->flags |= PF_THREAD_BOUND;
    wake_up_process(rescuer->task);
    }

    --
    1.7.3.4



    \
     
     \ /
      Last update: 2012-03-01 20:07    [W:0.031 / U:90.252 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site