From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
linux-kernel@vger.kernel.org, kernel-team@meta.com,
sched-ext@meta.com, Changwoo Min <multics69@gmail.com>
Subject: Re: [PATCH sched_ext/for-6.13 1/2] sched_ext: Avoid live-locking bypass mode switching
Date: Wed, 6 Nov 2024 00:57:42 +0100 [thread overview]
Message-ID: <Zyqw9rI-hbxhMqv_@gpd3> (raw)
In-Reply-To: <ZyqSm4B4NuzuHEbp@slm.duckdns.org>
Hi Tejun,
On Tue, Nov 05, 2024 at 11:48:11AM -1000, Tejun Heo wrote:
...
> +/*
> + * A poorly behaving BPF scheduler can live-lock the system by e.g. incessantly
> + * banging on the same DSQ on a large NUMA system to the point where switching
> + * to the bypass mode can take a long time. Inject artifical delays while the
> + * bypass mode is switching to guarantee timely completion.
> + */
> +static void scx_ops_breather(struct rq *rq)
> +{
> + u64 until;
> +
> + lockdep_assert_rq_held(rq);
> +
> + if (likely(!atomic_read(&scx_ops_breather_depth)))
> + return;
> +
> + raw_spin_rq_unlock(rq);
> +
> + until = ktime_get_ns() + NSEC_PER_MSEC;
> +
> + do {
> + int cnt = 1024;
> + while (atomic_read(&scx_ops_breather_depth) && --cnt)
> + cpu_relax();
> + } while (atomic_read(&scx_ops_breather_depth) &&
> + time_before64(ktime_get_ns(), until));
Do you think there's any benefit using the idle injection framework here
instead of this cpu_relax() loop? At the end we're trying to throttle
the scx scheduler from hammering a DSQ until the scheduler is kicked
out, so we may just inject real idle cycles?
-Andrea
next prev parent reply other threads:[~2024-11-05 23:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 21:48 [PATCH sched_ext/for-6.13 1/2] sched_ext: Avoid live-locking bypass mode switching Tejun Heo
2024-11-05 21:49 ` [PATCH sched_ext/for-6.13 2/2] sched_ext: Enable the ops breather and eject BPF scheduler on softlockup Tejun Heo
2024-11-06 21:32 ` Doug Anderson
2024-11-06 22:08 ` Tejun Heo
2024-11-06 23:02 ` Doug Anderson
2024-11-06 23:07 ` Tejun Heo
2024-11-06 23:20 ` Doug Anderson
2024-11-07 19:31 ` Tejun Heo
2024-11-08 20:38 ` Tejun Heo
2024-11-05 22:03 ` [PATCH sched_ext/for-6.13 1/2] sched_ext: Avoid live-locking bypass mode switching David Vernet
2024-11-05 23:02 ` Tejun Heo
2024-11-05 23:57 ` Andrea Righi [this message]
2024-11-06 0:26 ` Tejun Heo
2024-11-06 0:33 ` Andrea Righi
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=Zyqw9rI-hbxhMqv_@gpd3 \
--to=arighi@nvidia.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=multics69@gmail.com \
--cc=sched-ext@meta.com \
--cc=tj@kernel.org \
--cc=void@manifault.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