From: Qais Yousef <qyousef@layalina.io>
To: zihan zhou <15645113830zzh@gmail.com>
Cc: bsegall@google.com, dietmar.eggemann@arm.com,
juri.lelli@redhat.com, linux-kernel@vger.kernel.org,
mgorman@suse.de, mingo@redhat.com, peterz@infradead.org,
rostedt@goodmis.org, vincent.guittot@linaro.org,
vschneid@redhat.com
Subject: Re: [PATCH V3 1/2] sched: Reduce the default slice to avoid tasks getting an extra tick
Date: Mon, 10 Feb 2025 22:55:34 +0000 [thread overview]
Message-ID: <20250210225534.efd4onoo7mhodqhn@airbuntu> (raw)
In-Reply-To: <20250210061855.299323-1-15645113830zzh@gmail.com>
On 02/10/25 14:18, zihan zhou wrote:
> Thank you for your comments!
>
> > I brought the topic up of these magic values with Peter and Vincent in LPC as
> > I think this logic is confusing. I have nothing against your patch, but if the
> > maintainers agree I am in favour of removing it completely in favour of setting
> > it to a single value that is the same across all systems.
>
> Here is my shallow understanding:
> I think when the number of cpus is small, this type of machine is usually
> a desktop. If the slice is still relatively large, a task has to have a
> longer wake-up delay, which may result in a poorer user experience. When
> there are a large number of cpus, it is likely to mean that the machine is
> a server, its tasks often are batch workloads, a slight increase in slice
> is acceptable. And a server often has idle cpus or cpus with low load, So
> even if there are larger slice, the interaction experience is also not bad.
I think the logic has served its purpose and it's time to retire it. Any larger
than 8 CPUs will have the same mapping anyway. So let's simplify and make it
3ms by default for everyone.
So the suggestion is to remove this logic and always set base_slice to 3ms for
all systems instead. No need to do the scaling anymore.
>
> > I do think 1ms makes more sense as a default value given how modern workloads
> > need faster responsiveness across the board. But keeping it 3ms to avoid much
> > disturbance would be fine. We could also make it equal to TICK_MSEC (this
> > define doesn't exist) if it is higher than 3ms.
>
> I don't quite understand this. What is TICK_MSEC? If HZ=1000, then
> TICK_MSEC=1ms? Why is it said that more than 3ms (slice) equals 1ms (tick)?
I meant
base_slice = max(3ms, TICK_USEC * USEC_PER_MSEC)
I was lazy to type TICK_USEC * USEC_PER_MSEC and used TICK_MSEC instead.
But this is a bad idea. Please ignore it. With HZ=100 still selectable, doing
that will wreck havoc on wake up preemption on those systems.
>
> It seems that this value was originally designed for
> sysctl_sched_wakeup_granularity. CFS does not force tasks to switch after
> running for this time, but EEVDF does require it, So if slice is too small
> like 1ms, it looks not conducive to cache, and is not good for batch
> workloads.
>
> > Do you use HZ=100 by the way? If yes, are you able to share the reasons? This
> > configuration is too aggressive and bad for latencies and I doubt this tweak of
> > the formula will make things better to them anyway.
>
> I don't use HZ=100, in fact, all the machines I use have HZ=1000 and more
> than 8 cpus, so I'm not familiar with some scenarios.
>
> I think that if the slice is smaller than tick (10ms), there is not much
> difference between 3ms slice and 1ms slice in tick preemption, but the two
> are still different in wake-up preemption. After all, when waking up
> preemption, there also has update_curr->update_deadline, and the wake-up
> latency should be slightly lower with 1ms slice. So I think, when HZ=100,
> different slices still have an impact on latency.
I am trying to argue elsewhere to remove HZ=100. Just was curious if you
actually use this value and if yes why. Sorry a bit of a tangent :)
Thanks!
--
Qais Yousef
next prev parent reply other threads:[~2025-02-10 22:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-08 7:48 [PATCH V3 0/2] " zihan zhou
2025-02-08 7:53 ` [PATCH V3 1/2] " zihan zhou
2025-02-10 1:29 ` Qais Yousef
2025-02-10 6:18 ` zihan zhou
2025-02-10 22:55 ` Qais Yousef [this message]
2025-02-10 9:13 ` Peter Zijlstra
2025-02-10 23:05 ` Qais Yousef
2025-02-22 3:19 ` zihan zhou
2025-02-23 0:08 ` Qais Yousef
2025-02-24 14:15 ` Vincent Guittot
2025-02-25 0:25 ` Qais Yousef
2025-02-25 1:29 ` Vincent Guittot
2025-02-25 10:13 ` Vincent Guittot
2025-02-25 13:06 ` Qais Yousef
2025-02-14 3:33 ` K Prateek Nayak
2025-02-22 3:02 ` zihan zhou
2025-03-07 4:10 ` K Prateek Nayak
2025-03-14 1:49 ` zihan zhou
2025-02-15 10:55 ` [tip: sched/core] " tip-bot2 for zihan zhou
2025-02-08 7:57 ` [PATCH V3 2/2] " zihan zhou
2025-02-08 19:32 ` Vincent Guittot
2025-02-10 6:26 ` zihan zhou
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=20250210225534.efd4onoo7mhodqhn@airbuntu \
--to=qyousef@layalina.io \
--cc=15645113830zzh@gmail.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®