From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, vschneid@redhat.com,
linux-kernel@vger.kernel.org, parth@linux.ibm.com
Cc: qyousef@layalina.io, chris.hyser@oracle.com,
patrick.bellasi@matbug.net, David.Laight@aculab.com,
pjt@google.com, pavel@ucw.cz, tj@kernel.org, qperret@google.com,
tim.c.chen@linux.intel.com, joshdon@google.com, timj@gnu.org,
kprateek.nayak@amd.com, yu.c.chen@intel.com,
youssefesmat@chromium.org, joel@joelfernandes.org
Subject: Re: [PATCH v8 1/9] sched/fair: fix unfairness at wakeup
Date: Mon, 14 Nov 2022 20:13:47 +0100 [thread overview]
Message-ID: <32f4a76d-103e-510f-de70-ba9dfe2356ce@arm.com> (raw)
In-Reply-To: <20221110175009.18458-2-vincent.guittot@linaro.org>
On 10/11/2022 18:50, Vincent Guittot wrote:
> At wake up, the vruntime of a task is updated to not be more older than
> a sched_latency period behind the min_vruntime. This prevents long sleeping
> task to get unlimited credit at wakeup.
> Such waking task should preempt current one to use its CPU bandwidth but
> wakeup_gran() can be larger than sched_latency, filter out the
> wakeup preemption and as a results steals some CPU bandwidth to
> the waking task.
>
> Make sure that a task, which vruntime has been capped, will preempt current
> task and use its CPU bandwidth even if wakeup_gran() is in the same range
> as sched_latency.
Looks like that gran can be nuch higher than sched_latency for extreme
cases?
>
> If the waking task failed to preempt current it could to wait up to
> sysctl_sched_min_granularity before preempting it during next tick.
>
> Strictly speaking, we should use cfs->min_vruntime instead of
> curr->vruntime but it doesn't worth the additional overhead and complexity
> as the vruntime of current should be close to min_vruntime if not equal.
^^^ Does this related to the `if (vdiff > gran) return 1` condition in
wakeup_preempt_entity()?
[...]
> @@ -7187,6 +7171,18 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)
> return -1;
>
> gran = wakeup_gran(se);
> +
> + /*
> + * At wake up, the vruntime of a task is capped to not be older than
> + * a sched_latency period compared to min_vruntime. This prevents long
> + * sleeping task to get unlimited credit at wakeup. Such waking up task
> + * has to preempt current in order to not lose its share of CPU
> + * bandwidth but wakeup_gran() can become higher than scheduling period
> + * for low priority task. Make sure that long sleeping task will get a
low priority task or taskgroup with low cpu.shares, right?
6 CPUs
sysctl_sched
.sysctl_sched_latency : 18.000000
.sysctl_sched_min_granularity : 2.250000
.sysctl_sched_idle_min_granularity : 0.750000
.sysctl_sched_wakeup_granularity : 3.000000
...
p1 & p2 affine to CPUX
'/'
/\
p1 p2
p1 & p2 nice=0 - vdiff=9ms gran=3ms lat_max=6.75ms
p1 & p2 nice=4 - vdiff=9ms gran=7.26ms lat_max=6.75ms
p1 & p2 nice=19 - vdiff=9ms gran=204.79ms lat_max=6.75ms
'/'
/\
A B
/ \
p1 p2
A & B cpu.shares=1024 - vdiff=9ms gran=3ms lat_max=6.75ms
A & B cpu.shares=448 - vdiff=9ms gran=6.86ms lat_max=6.75ms
A & B cpu.shares=2 - vdiff=9ms gran=1536ms lat_max=6.75ms
> + * chance to preempt current.
> + */
> + gran = min_t(s64, gran, get_latency_max());
> +
[...]
> @@ -2448,6 +2448,34 @@ extern unsigned int sysctl_numa_balancing_scan_period_max;
> extern unsigned int sysctl_numa_balancing_scan_size;
> #endif
>
> +static inline unsigned long get_sched_latency(bool idle)
^^
2 white-spaces
[...]
> +
> +static inline unsigned long get_latency_max(void)
^^
[...]
next prev parent reply other threads:[~2022-11-14 19:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 17:50 [PATCH v8 0/9] Add latency priority for CFS class Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 1/9] sched/fair: fix unfairness at wakeup Vincent Guittot
2022-11-14 3:06 ` Joel Fernandes
2022-11-14 11:05 ` Vincent Guittot
2022-11-16 2:10 ` Joel Fernandes
2022-11-16 8:25 ` Aaron Lu
2022-11-17 9:18 ` Vincent Guittot
2022-11-14 16:19 ` Patrick Bellasi
2022-11-14 16:46 ` Vincent Guittot
2022-11-14 19:13 ` Dietmar Eggemann [this message]
2022-11-15 7:26 ` Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 2/9] sched: Introduce latency-nice as a per-task attribute Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 3/9] sched/core: Propagate parent task's latency requirements to the child task Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 4/9] sched: Allow sched_{get,set}attr to change latency_nice of the task Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 5/9] sched/fair: Take into account latency priority at wakeup Vincent Guittot
2022-11-14 16:20 ` Patrick Bellasi
2022-11-15 15:40 ` Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 6/9] sched/fair: Add sched group latency support Vincent Guittot
2022-11-14 16:20 ` Patrick Bellasi
2022-11-14 16:57 ` Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 7/9] sched/core: Support latency priority with sched core Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 8/9] sched/fair: Add latency list Vincent Guittot
2022-11-10 17:50 ` [PATCH v8 9/9] sched/fair: remove check_preempt_from_others Vincent Guittot
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=32f4a76d-103e-510f-de70-ba9dfe2356ce@arm.com \
--to=dietmar.eggemann@arm.com \
--cc=David.Laight@aculab.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=chris.hyser@oracle.com \
--cc=joel@joelfernandes.org \
--cc=joshdon@google.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=parth@linux.ibm.com \
--cc=patrick.bellasi@matbug.net \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=qperret@google.com \
--cc=qyousef@layalina.io \
--cc=rostedt@goodmis.org \
--cc=tim.c.chen@linux.intel.com \
--cc=timj@gnu.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=youssefesmat@chromium.org \
--cc=yu.c.chen@intel.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
all inboxes | Powered by JetHome®