[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140914091338.GN346@worktop.programming.kicks-ass.net>
Date: Sun, 14 Sep 2014 11:13:38 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Kirill Tkhai <ktkhai@...allels.com>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
tkhai@...dex.ru
Subject: Re: [PATCH] sched: Do not stop cpu in set_cpus_allowed_ptr() if task
is not running
On Fri, Sep 12, 2014 at 03:03:34PM +0400, Kirill Tkhai wrote:
>
> If a task is queued but not running on it rq, we can simply migrate
> it without migration thread and switching of context.
>
> Signed-off-by: Kirill Tkhai <ktkhai@...allels.com>
> ---
> kernel/sched/core.c | 47 ++++++++++++++++++++++++++++++++---------------
> 1 file changed, 32 insertions(+), 15 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index d4399b4..dbbba26 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4594,6 +4594,33 @@ void init_idle(struct task_struct *idle, int cpu)
> }
>
> #ifdef CONFIG_SMP
> +/*
> + * move_queued_task - move a queued task to new rq.
> + *
> + * Returns (locked) new rq. Old rq's lock is released.
> + */
> +static struct rq *move_queued_task(struct task_struct *p, int new_cpu)
> +{
> + struct rq *rq = task_rq(p);
> +
> + lockdep_assert_held(&rq->lock);
> +
> + dequeue_task(rq, p, 0);
> + p->on_rq = TASK_ON_RQ_MIGRATING;
> + set_task_cpu(p, new_cpu);
> + raw_spin_unlock(&rq->lock);
> +
> + rq = cpu_rq(new_cpu);
> +
> + raw_spin_lock(&rq->lock);
> + BUG_ON(task_cpu(p) != new_cpu);
> + p->on_rq = TASK_ON_RQ_QUEUED;
> + enqueue_task(rq, p, 0);
> + check_preempt_curr(rq, p, 0);
> +
> + return rq;
> +}
We have almost that exact code sequence in __migrate_task() could we
share some?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists