[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d868b010-b9e1-4291-aad5-ee03c133b1dc@amd.com>
Date: Tue, 10 Feb 2026 10:46:28 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: Peter Zijlstra <peterz@...radead.org>
CC: <mingo@...nel.org>, <juri.lelli@...hat.com>, <vincent.guittot@...aro.org>,
<dietmar.eggemann@....com>, <rostedt@...dmis.org>, <bsegall@...gle.com>,
<mgorman@...e.de>, <vschneid@...hat.com>, <linux-kernel@...r.kernel.org>,
<wangtao554@...wei.com>, <quzicheng@...wei.com>, <wuyun.abel@...edance.com>,
<dsmythies@...us.net>
Subject: Re: [PATCH 0/4] sched: Various reweight_entity() fixes
Hello Peter,
On 2/9/2026 9:17 PM, Peter Zijlstra wrote:
> I ended up with the below; and I've already pushed out a fresh
> queue/sched/core. Could you please test again?
I haven't seen any "sum_shifts" turning non-zero on the overnight runs,
even with the larger workloads, so feel free to include:
Tested-by: K Prateek Nayak <kprateek.nayak@....com>
The overall patch looks good. I only have couple of cosmetic nits
inlined below:
[..snip..]
> u64 avg_vruntime(struct cfs_rq *cfs_rq)
> {
> struct sched_entity *curr = cfs_rq->curr;
> - s64 avg = cfs_rq->sum_w_vruntime;
> - long load = cfs_rq->sum_weight;
> + s64 delta = 0, runtime = cfs_rq->sum_w_vruntime;
nit.
"runtime" is only ever used in "weight" != 0 case so perhaps it can be
moved there to preserve the reverse x-mas (or this whole line can be
moved up top).
> + long weight = cfs_rq->sum_weight;
>
> - if (curr && curr->on_rq) {
> - unsigned long weight = scale_load_down(curr->load.weight);
> + if (curr && !curr->on_rq)
> + curr = NULL;
>
> - avg += entity_key(cfs_rq, curr) * weight;
> - load += weight;
> - }
> + if (weight) {
> + if (curr) {
> + unsigned long w = scale_load_down(curr->load.weight);
> +
> + runtime += entity_key(cfs_rq, curr) * w;
> + weight += w;
> + }
>
> - if (load) {
> /* sign flips effective floor / ceiling */
> - if (avg < 0)
> - avg -= (load - 1);
> - avg = div_s64(avg, load);
> + if (runtime < 0)
> + runtime -= (weight - 1);
> +
> + delta = div_s64(runtime, weight);
> +
nit. Is this empty line necessary?
> + } else if (curr) {
> + /*
> + * When there is but one element, it is the average.
> + */
> + delta = curr->vruntime - cfs_rq->zero_vruntime;
> }
>
> - return cfs_rq->zero_vruntime + avg;
> + update_zero_vruntime(cfs_rq, delta);
> +
> + return cfs_rq->zero_vruntime;
> }
>
> /*
--
Thanks and Regards,
Prateek
Powered by blists - more mailing lists