From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Jing-Ting Wu <jing-ting.wu@mediatek.com>,
Peter Zijlstra <peterz@infradead.org>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org,
Steven Rostedt <rostedt@goodmis.org>,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
wsd_upstream@mediatek.com
Subject: Re: [PATCH 1/1] sched/rt: avoid contend with CFS task
Date: Thu, 3 Oct 2019 18:25:30 +0200 [thread overview]
Message-ID: <7bd9506b-9930-0bf8-a024-8c7d7d8bf86e@arm.com> (raw)
In-Reply-To: <1567048502-6064-1-git-send-email-jing-ting.wu@mediatek.com>
[+ Steven Rostedt <rostedt@goodmis.org>]
On 29/08/2019 05:15, Jing-Ting Wu wrote:
> At original linux design, RT & CFS scheduler are independent.
> Current RT task placement policy will select the first cpu in
> lowest_mask, even if the first CPU is running a CFS task.
> This may put RT task to a running cpu and let CFS task runnable.
>
> So we select idle cpu in lowest_mask first to avoid preempting
> CFS task.
>
> Signed-off-by: Jing-Ting Wu <jing-ting.wu@mediatek.com>
> ---
> kernel/sched/rt.c | 42 +++++++++++++++++-------------------------
> 1 file changed, 17 insertions(+), 25 deletions(-)
>
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index a532558..626ca27 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1388,7 +1388,6 @@ static void yield_task_rt(struct rq *rq)
> static int
> select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
> {
> - struct task_struct *curr;
> struct rq *rq;
>
> /* For anything but wake ups, just return the task_cpu */
> @@ -1398,33 +1397,15 @@ static void yield_task_rt(struct rq *rq)
> rq = cpu_rq(cpu);
>
> rcu_read_lock();
> - curr = READ_ONCE(rq->curr); /* unlocked access */
>
> /*
> - * If the current task on @p's runqueue is an RT task, then
> - * try to see if we can wake this RT task up on another
> - * runqueue. Otherwise simply start this RT task
> - * on its current runqueue.
> - *
> - * We want to avoid overloading runqueues. If the woken
> - * task is a higher priority, then it will stay on this CPU
> - * and the lower prio task should be moved to another CPU.
> - * Even though this will probably make the lower prio task
> - * lose its cache, we do not want to bounce a higher task
> - * around just because it gave up its CPU, perhaps for a
> - * lock?
> - *
> - * For equal prio tasks, we just let the scheduler sort it out.
> - *
> - * Otherwise, just let it ride on the affined RQ and the
> - * post-schedule router will push the preempted task away
> - *
> - * This test is optimistic, if we get it wrong the load-balancer
> - * will have to sort it out.
> + * If the task p is allowed to put more than one CPU or
> + * it is not allowed to put on this CPU.
> + * Let p use find_lowest_rq to choose other idle CPU first,
> + * instead of choose this cpu and preempt curr cfs task.
> */
> - if (curr && unlikely(rt_task(curr)) &&
> - (curr->nr_cpus_allowed < 2 ||
> - curr->prio <= p->prio)) {
> + if ((p->nr_cpus_allowed > 1) ||
> + (!cpumask_test_cpu(cpu, p->cpus_ptr))) {
> int target = find_lowest_rq(p);
I'm sure RT folks don't like the idea to change this condition.
I remember a similar approach and Steven Rostedt NAKed the idea back:
https://lore.kernel.org/r/1415099585-31174-2-git-send-email-pang.xunlei@linaro.org
Back then, Xunlei Pang even tried to create a lower mask of idle CPUs,
for find_lower_mask() to return:
https://lore.kernel.org/r/1415099585-31174-1-git-send-email-pang.xunlei@linaro.org
[...]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-10-03 16:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 3:15 [PATCH 1/1] sched/rt: avoid contend with CFS task Jing-Ting Wu
2019-08-29 10:38 ` Valentin Schneider
2019-08-30 14:55 ` Qais Yousef
2019-09-05 13:26 ` Jing-Ting Wu
2019-09-05 14:01 ` Vincent Guittot
2019-09-19 11:22 ` Jing-Ting Wu
2019-09-19 12:27 ` Vincent Guittot
2019-09-19 14:23 ` Qais Yousef
2019-09-19 14:32 ` Vincent Guittot
2019-09-19 14:37 ` Vincent Guittot
2019-09-19 15:11 ` Qais Yousef
2019-10-02 1:20 ` Jing-Ting Wu
2019-10-09 10:56 ` Qais Yousef
2019-10-03 16:25 ` Dietmar Eggemann [this message]
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=7bd9506b-9930-0bf8-a024-8c7d7d8bf86e@arm.com \
--to=dietmar.eggemann@arm.com \
--cc=jing-ting.wu@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=wsd_upstream@mediatek.com \
/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