[<prev] [next>] [day] [month] [year] [list]
Message-ID: <50E70E6B-E2B5-4FFD-B54F-78B365751C9C@os.amperecomputing.com>
Date: Wed, 17 Dec 2025 19:22:53 +0000
From: Shubhang Kaushik Prasanna Kumar <shkaushik@...erecomputing.com>
To: "zhanxusheng1024@...il.com" <zhanxusheng1024@...il.com>
CC: "dietmar.eggemann@....com" <dietmar.eggemann@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-sched@...r.kernel.org" <linux-sched@...r.kernel.org>,
"peterz@...radead.org" <peterz@...radead.org>, "vincent.guittot@...aro.org"
<vincent.guittot@...aro.org>, "zhanxusheng@...omi.com"
<zhanxusheng@...omi.com>
Subject: Re: [PATCH] sched/fair: factor out common sched_entity stats/task
lookup
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, given how hot these paths are, using `__always_inline` would be safer than just `inline` to reduce function call overhead.
Thanks,
Shubhang Kaushik
Powered by blists - more mailing lists