lkml.org 
[lkml]   [2011]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[RFC][PATCH 2/3] sched, workqueue: Move WQ-sleeper wakeup
    While Thomas was annoyed with the block bits, he found no reason for the WQ
    bits to be as they are, the signal thing can only avoid a wakeup, extra wakeups
    for the WQ bits increase concurrency (in as far as signals are relevant to
    kthreads at all).

    Moving the WQ bits allow us to do away with try_to_wake_up_local, removing
    more lines.

    Cc: Tejun Heo <tj@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    ---
    kernel/sched.c | 60 ++++++++++++---------------------------------------------
    1 file changed, 13 insertions(+), 47 deletions(-)

    Index: linux-2.6/kernel/sched.c
    ===================================================================
    --- linux-2.6.orig/kernel/sched.c
    +++ linux-2.6/kernel/sched.c
    @@ -2703,40 +2703,6 @@ try_to_wake_up(struct task_struct *p, un
    }

    /**
    - * try_to_wake_up_local - try to wake up a local task with rq lock held
    - * @p: the thread to be awakened
    - *
    - * Put @p on the run-queue if it's not already there. The caller must
    - * ensure that this_rq() is locked, @p is bound to this_rq() and not
    - * the current task.
    - */
    -static void try_to_wake_up_local(struct task_struct *p)
    -{
    - struct rq *rq = task_rq(p);
    -
    - BUG_ON(rq != this_rq());
    - BUG_ON(p == current);
    - lockdep_assert_held(&rq->lock);
    -
    - if (!raw_spin_trylock(&p->pi_lock)) {
    - raw_spin_unlock(&rq->lock);
    - raw_spin_lock(&p->pi_lock);
    - raw_spin_lock(&rq->lock);
    - }
    -
    - if (!(p->state & TASK_NORMAL))
    - goto out;
    -
    - if (!p->on_rq)
    - ttwu_activate(rq, p, ENQUEUE_WAKEUP);
    -
    - ttwu_do_wakeup(rq, p, 0);
    - ttwu_stat(p, smp_processor_id(), 0);
    -out:
    - raw_spin_unlock(&p->pi_lock);
    -}
    -
    -/**
    * wake_up_process - Wake up a specific process
    * @p: The process to be woken up.
    *
    @@ -4215,6 +4181,19 @@ static inline void sched_submit_work(voi

    if (tsk->state && !(preempt_count() & PREEMPT_ACTIVE)) {
    /*
    + * If a worker went to sleep, notify and ask workqueue
    + * whether it wants to wake up a task to maintain
    + * concurrency.
    + */
    + if (tsk->flags & PF_WQ_WORKER) {
    + struct task_struct *to_wakeup;
    +
    + to_wakeup = wq_worker_sleeping(tsk, smp_processor_id());
    + if (to_wakeup)
    + wake_up_process(to_wakeup);
    + }
    +
    + /*
    * If we are going to sleep and we have plugged IO
    * queued, make sure to submit it to avoid deadlocks.
    */
    @@ -4256,19 +4235,6 @@ asmlinkage void __sched schedule(void)
    } else {
    deactivate_task(rq, prev, DEQUEUE_SLEEP);
    prev->on_rq = 0;
    -
    - /*
    - * If a worker went to sleep, notify and ask workqueue
    - * whether it wants to wake up a task to maintain
    - * concurrency.
    - */
    - if (prev->flags & PF_WQ_WORKER) {
    - struct task_struct *to_wakeup;
    -
    - to_wakeup = wq_worker_sleeping(prev, cpu);
    - if (to_wakeup)
    - try_to_wake_up_local(to_wakeup);
    - }
    }
    switch_count = &prev->nvcsw;
    }



    \
     
     \ /
      Last update: 2011-06-22 01:49    [W:0.023 / U:0.040 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site