From: Shubhang Kaushik Prasanna Kumar <shkaushik@amperecomputing.com>
To: "zhanxusheng1024@gmail.com" <zhanxusheng1024@gmail.com>
Cc: "dietmar.eggemann@arm.com" <dietmar.eggemann@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-sched@vger.kernel.org" <linux-sched@vger.kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>,
"zhanxusheng@xiaomi.com" <zhanxusheng@xiaomi.com>
Subject: Re: [PATCH] sched/fair: factor out common sched_entity stats/task lookup
Date: Wed, 17 Dec 2025 18:50:23 +0000 [thread overview]
Message-ID: <466CB94B-6078-4CC9-AB9B-6863BCC86E08@os.amperecomputing.com> (raw)
Hi Zhan,
The cleanup looks nice, but these helpers are sitting in some very critical hot paths. `update_stats_wait_end_fair` and `update_stats_enqueue_sleeper_fair` are hit on practically every task wakeup and context switch.
Even though it's not a functional refactoring, have you verified it with any benchmarks? I'm concerned that introducing the helper and passing around addresses of local variables (&stats, &p) might make it harder for the compiler to optimize compared to the original version.
I'm actually looking at a similar improvement in the PELT area, so I'd be curious to know if you've seen any measurable change in overhead.. To help the compiler, it might be better to have the helper return the stats pointer directly rather than passing &stats. This avoids the "double indirection" and makes it easier for the compiler to keep everything in registers. Also, for these hot paths, using `__always_inline` would be safer than just `inline` to avoid possible overhead.
Thanks,
Shubhang Kaushik
next reply other threads:[~2025-12-18 1:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 18:50 Shubhang Kaushik Prasanna Kumar [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-12-17 19:22 Shubhang Kaushik Prasanna Kumar
2025-12-17 19:22 ` Shubhang Kaushik Prasanna Kumar
2025-12-17 18:50 Shubhang Kaushik Prasanna Kumar
2025-12-17 7:00 Zhan Xusheng
2025-12-18 8:14 ` Peter Zijlstra
2025-12-21 18:52 ` kernel test robot
2025-12-21 20:54 ` kernel test robot
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=466CB94B-6078-4CC9-AB9B-6863BCC86E08@os.amperecomputing.com \
--to=shkaushik@amperecomputing.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sched@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=vincent.guittot@linaro.org \
--cc=zhanxusheng1024@gmail.com \
--cc=zhanxusheng@xiaomi.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®