From: Rik van Riel <riel@surriel.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: use rq_clock_task() in update_tg_load_avg() rate-limit
Date: Wed, 27 May 2026 07:51:03 -0400 [thread overview]
Message-ID: <6d6098930b30b8175b948bda03dc01bf4f91823b.camel@surriel.com> (raw)
In-Reply-To: <CAKfTPtAT19WzCVbCVEnZzCsEVZ4k_tP8PUAL7P=yEFQOAk9q8g@mail.gmail.com>
On Wed, 2026-05-27 at 10:17 +0200, Vincent Guittot wrote:
> On Wed, 27 May 2026 at 09:37, Vincent Guittot
> <vincent.guittot@linaro.org> wrote:
> >
> > On Wed, 27 May 2026 at 03:32, Rik van Riel <riel@surriel.com>
> > wrote:
> > >
> > > +++ b/kernel/sched/fair.c
> > > @@ -4429,8 +4429,15 @@ static inline void
> > > update_tg_load_avg(struct cfs_rq *cfs_rq)
> > > /*
> > > * For migration heavy workloads, access to tg->load_avg
> > > can be
> > > * unbound. Limit the update rate to at most once per ms.
> > > - */
> > > - now = sched_clock_cpu(cpu_of(rq_of(cfs_rq)));
> > > + *
> > > + * The enclosing PELT update paths always hold rq->lock
> > > and have
> > > + * called update_rq_clock(rq) within microseconds, so rq-
> > > >clock_task
> > > + * is fresh. Use it instead of sched_clock_cpu() to
> > > avoid an rdtsc
> > > + * (plus pipeline serialisation) per call -- this
> > > function is invoked
> > > + * once per leaf cfs_rq in __update_blocked_fair(), so on
> > > hosts with
> > > + * many cgroups the rdtsc cost dominates the rate-limit
> > > check itself.
> > > + */
> > > + now = rq_clock_task(rq_of(cfs_rq));
>
> Why not using rq_clock() ? This removes rdtsc call and still move
> forward whatever the irq pressure
Good idea, that does seem like a better clock to use!
Does that also automatically eliminate the worry about
task migration, since update_rq_clock() gets called
whenever a task is attached, rqs get attached/detached,
and in various other points including the load balancing
code?
--
All Rights Reversed.
next prev parent reply other threads:[~2026-05-27 11:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 1:31 Rik van Riel
2026-05-27 3:30 ` Aaron Lu
2026-05-27 7:37 ` Vincent Guittot
2026-05-27 8:17 ` Vincent Guittot
2026-05-27 11:51 ` Rik van Riel [this message]
2026-05-27 12:21 ` 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=6d6098930b30b8175b948bda03dc01bf4f91823b.camel@surriel.com \
--to=riel@surriel.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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®