From: Peter Zijlstra <peterz@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Valentin Schneider <vschneid@redhat.com>,
Ingo Molnar <mingo@kernel.org>,
x86@kernel.org
Subject: Re: [tip: sched/core] sched/rt: Make rt_rq->pushable_tasks updates drive rto_mask
Date: Mon, 25 Sep 2023 12:11:27 +0200 [thread overview]
Message-ID: <20230925101127.GB31921@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <169563211069.27769.17070510461354463740.tip-bot2@tip-bot2>
On Mon, Sep 25, 2023 at 08:55:10AM -0000, tip-bot2 for Valentin Schneider wrote:
> The following commit has been merged into the sched/core branch of tip:
>
> Commit-ID: 612f769edd06a6e42f7cd72425488e68ddaeef0a
> Gitweb: https://git.kernel.org/tip/612f769edd06a6e42f7cd72425488e68ddaeef0a
> Author: Valentin Schneider <vschneid@redhat.com>
> AuthorDate: Fri, 11 Aug 2023 12:20:44 +01:00
> Committer: Ingo Molnar <mingo@kernel.org>
> CommitterDate: Mon, 25 Sep 2023 10:25:29 +02:00
>
> sched/rt: Make rt_rq->pushable_tasks updates drive rto_mask
>
> Sebastian noted that the rto_push_work IRQ work can be queued for a CPU
> that has an empty pushable_tasks list, which means nothing useful will be
> done in the IPI other than queue the work for the next CPU on the rto_mask.
>
> rto_push_irq_work_func() only operates on tasks in the pushable_tasks list,
> but the conditions for that irq_work to be queued (and for a CPU to be
> added to the rto_mask) rely on rq_rt->nr_migratory instead.
>
> nr_migratory is increased whenever an RT task entity is enqueued and it has
> nr_cpus_allowed > 1. Unlike the pushable_tasks list, nr_migratory includes a
> rt_rq's current task. This means a rt_rq can have a migratible current, N
> non-migratible queued tasks, and be flagged as overloaded / have its CPU
> set in the rto_mask, despite having an empty pushable_tasks list.
>
> Make an rt_rq's overload logic be driven by {enqueue,dequeue}_pushable_task().
> Since rt_rq->{rt_nr_migratory,rt_nr_total} become unused, remove them.
>
> Note that the case where the current task is pushed away to make way for a
> migration-disabled task remains unchanged: the migration-disabled task has
> to be in the pushable_tasks list in the first place, which means it has
> nr_cpus_allowed > 1.
>
> Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Valentin Schneider <vschneid@redhat.com>
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Link: https://lore.kernel.org/r/20230811112044.3302588-1-vschneid@redhat.com
> ---
> kernel/sched/debug.c | 3 +--
> kernel/sched/rt.c | 70 ++++++-------------------------------------
> kernel/sched/sched.h | 2 +-
> 3 files changed, 10 insertions(+), 65 deletions(-)
>
> @@ -358,53 +357,6 @@ static inline void rt_clear_overload(struct rq *rq)
> cpumask_clear_cpu(rq->cpu, rq->rd->rto_mask);
> }
>
> -static void update_rt_migration(struct rt_rq *rt_rq)
> -{
> - if (rt_rq->rt_nr_migratory && rt_rq->rt_nr_total > 1) {
> - if (!rt_rq->overloaded) {
> - rt_set_overload(rq_of_rt_rq(rt_rq));
> - rt_rq->overloaded = 1;
> - }
> - } else if (rt_rq->overloaded) {
> - rt_clear_overload(rq_of_rt_rq(rt_rq));
> - rt_rq->overloaded = 0;
> - }
> -}
> -
> -static void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
> -{
> - struct task_struct *p;
> -
> - if (!rt_entity_is_task(rt_se))
> - return;
> -
> - p = rt_task_of(rt_se);
> - rt_rq = &rq_of_rt_rq(rt_rq)->rt;
> -
> - rt_rq->rt_nr_total++;
> - if (p->nr_cpus_allowed > 1)
> - rt_rq->rt_nr_migratory++;
> -
> - update_rt_migration(rt_rq);
> -}
> -
> -static void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
> -{
> - struct task_struct *p;
> -
> - if (!rt_entity_is_task(rt_se))
> - return;
> -
> - p = rt_task_of(rt_se);
> - rt_rq = &rq_of_rt_rq(rt_rq)->rt;
> -
> - rt_rq->rt_nr_total--;
> - if (p->nr_cpus_allowed > 1)
> - rt_rq->rt_nr_migratory--;
> -
> - update_rt_migration(rt_rq);
> -}
sched/deadline.c has something very similar, does that need updating
too?
next prev parent reply other threads:[~2023-09-25 10:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 11:20 [PATCH] " Valentin Schneider
2023-08-15 14:21 ` Sebastian Andrzej Siewior
2023-09-11 10:54 ` Valentin Schneider
2023-09-20 13:38 ` Sebastian Andrzej Siewior
2023-09-25 8:27 ` Ingo Molnar
2023-09-25 12:09 ` Valentin Schneider
2023-09-25 8:55 ` [tip: sched/core] " tip-bot2 for Valentin Schneider
2023-09-25 10:11 ` Peter Zijlstra [this message]
2023-09-25 12:21 ` Valentin Schneider
2023-09-28 21:21 ` Ingo Molnar
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=20230925101127.GB31921@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=vschneid@redhat.com \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®