From: Kirill Tkhai <tkhai@yandex.ru>
To: Peter Zijlstra <peterz@infradead.org>,
Kirill Tkhai <ktkhai@parallels.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] sched: Do not stop cpu in set_cpus_allowed_ptr() if task is not running
Date: Sun, 14 Sep 2014 13:20:32 +0400 [thread overview]
Message-ID: <54155DE0.7040606@yandex.ru> (raw)
In-Reply-To: <20140914091338.GN346@worktop.programming.kicks-ass.net>
On 14.09.2014 13:13, Peter Zijlstra wrote:
> 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@parallels.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?
>
Peter, haven't I moved the sequence from __migrate_task??
Rechecked again; yes, patch makes __migrate_task using new move_queued_task.
Kirill
next prev parent reply other threads:[~2014-09-14 9:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-12 11:03 Kirill Tkhai
2014-09-14 9:13 ` Peter Zijlstra
2014-09-14 9:20 ` Kirill Tkhai [this message]
2014-09-14 9:55 ` Peter Zijlstra
2014-09-14 9:57 ` Kirill Tkhai
2014-09-15 9:48 ` Preeti Murthy
2014-09-15 10:02 ` Kirill Tkhai
2014-09-15 11:37 ` Peter Zijlstra
2014-09-16 11:29 ` Preeti U Murthy
2014-09-19 11:46 ` [tip:sched/core] " tip-bot for Kirill Tkhai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54155DE0.7040606@yandex.ru \
--to=tkhai@yandex.ru \
--cc=ktkhai@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome