[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <X/i+3G53+AH4FfM2@hirez.programming.kicks-ass.net>
Date: Fri, 8 Jan 2021 21:21:48 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Mel Gorman <mgorman@...hsingularity.net>
Cc: "Li, Aubrey" <aubrey.li@...ux.intel.com>,
vincent.guittot@...aro.org, linux-kernel@...r.kernel.org,
mingo@...hat.com, juri.lelli@...hat.com,
valentin.schneider@....com, qais.yousef@....com,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
tim.c.chen@...ux.intel.com, benbjiang@...il.com
Subject: Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost
accounting
On Fri, Jan 08, 2021 at 10:27:38AM +0000, Mel Gorman wrote:
> 1. avg_scan_cost is now based on the average scan cost of a rq but
> avg_idle is still scaled to the domain size. This is a bit problematic
> because it's comparing scan cost of a single rq with the estimated
> average idle time of a domain. As a result, the scan depth can be much
> larger than it was before the patch and led to some regressions.
> @@ -6164,25 +6164,25 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
> */
> avg_idle = this_rq()->avg_idle / 512;
> avg_cost = this_sd->avg_scan_cost + 1;
> -
> - span_avg = sd->span_weight * avg_idle;
> - if (span_avg > 4*avg_cost)
> - nr = div_u64(span_avg, avg_cost);
> - else
> + nr = div_u64(avg_idle, avg_cost);
> + if (nr < 4)
> nr = 4;
Oooh, could it be I simply didn't remember how that code was supposed to
work and should kick my (much) younger self for not writing a comment?
Consider:
span_weight * avg_idle avg_cost
nr = ---------------------- = avg_idle / ----------
avg_cost span_weigt
Where: avg_cost / span_weight ~= cost-per-rq
Powered by blists - more mailing lists