Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-11 Thread Mel Gorman
On Mon, Jan 11, 2021 at 03:36:57PM +0100, Vincent Guittot wrote: > > > > > > > > > I think > > > that we should decay it periodically to reflect there is less and less > > > idle time (in fact no more) on this busy CPU that never goes to idle. > > > If a cpu was idle for a long period but then a

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-11 Thread Vincent Guittot
On Fri, 8 Jan 2021 at 20:49, Peter Zijlstra wrote: > > On Fri, Jan 08, 2021 at 04:10:51PM +0100, Vincent Guittot wrote: > > Another thing that worries me, is that we use the avg_idle of the > > local cpu, which is obviously not idle otherwise it would have been > > selected, to decide how much

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-11 Thread Vincent Guittot
On Fri, 8 Jan 2021 at 20:45, Peter Zijlstra wrote: > > On Fri, Jan 08, 2021 at 04:10:51PM +0100, Vincent Guittot wrote: > > Also, there is another problem (that I'm investigating) which is that > > this_rq()->avg_idle is stalled when your cpu is busy. Which means that > > this avg_idle can just

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-11 Thread Vincent Guittot
On Fri, 8 Jan 2021 at 17:14, Mel Gorman wrote: > > On Fri, Jan 08, 2021 at 04:10:51PM +0100, Vincent Guittot wrote: > > > > Trying to bias the avg_scan_cost with: loops <<= 2; > > > > will just make avg_scan_cost lost any kind of meaning because it > > > > doesn't reflect the avg cost of

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-09 Thread Mel Gorman
On Fri, Jan 08, 2021 at 08:45:44PM +0100, Peter Zijlstra wrote: > On Fri, Jan 08, 2021 at 04:10:51PM +0100, Vincent Guittot wrote: > > Also, there is another problem (that I'm investigating) which is that > > this_rq()->avg_idle is stalled when your cpu is busy. Which means that > > this avg_idle

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-09 Thread Mel Gorman
On Fri, Jan 08, 2021 at 09:21:48PM +0100, Peter Zijlstra wrote: > On Fri, Jan 08, 2021 at 10:27:38AM +, 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

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Peter Zijlstra
On Fri, Jan 08, 2021 at 10:27:38AM +, 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

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Peter Zijlstra
On Fri, Jan 08, 2021 at 04:10:51PM +0100, Vincent Guittot wrote: > Another thing that worries me, is that we use the avg_idle of the > local cpu, which is obviously not idle otherwise it would have been > selected, to decide how much time we should spend on looking for > another idle CPU. I'm not

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Peter Zijlstra
On Fri, Jan 08, 2021 at 04:10:51PM +0100, Vincent Guittot wrote: > Also, there is another problem (that I'm investigating) which is that > this_rq()->avg_idle is stalled when your cpu is busy. Which means that > this avg_idle can just be a very old and meaningless value. I think > that we should

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Mel Gorman
On Fri, Jan 08, 2021 at 04:10:51PM +0100, Vincent Guittot wrote: > > > Trying to bias the avg_scan_cost with: loops <<= 2; > > > will just make avg_scan_cost lost any kind of meaning because it > > > doesn't reflect the avg cost of scanning a rq anymore > > > > > > > Before the series, the

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Vincent Guittot
On Fri, 8 Jan 2021 at 15:41, Mel Gorman wrote: > > On Fri, Jan 08, 2021 at 02:41:19PM +0100, Vincent Guittot 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

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Mel Gorman
On Fri, Jan 08, 2021 at 02:41:19PM +0100, Vincent Guittot 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 > >

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Mel Gorman
On Fri, Jan 08, 2021 at 01:01:10PM +, Qais Yousef wrote: > On 01/08/21 10:27, Mel Gorman wrote: > > for_each_cpu_wrap(cpu, cpus, target) { > > - if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) > > + if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) { > > +

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Vincent Guittot
On Fri, 8 Jan 2021 at 11:27, Mel Gorman wrote: > > On Tue, Dec 15, 2020 at 08:59:11AM +0100, Peter Zijlstra wrote: > > On Tue, Dec 15, 2020 at 11:36:35AM +0800, Li, Aubrey wrote: > > > On 2020/12/15 0:48, Peter Zijlstra wrote: > > > > We compute the average cost of the total scan, but then use it

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Qais Yousef
On 01/08/21 10:27, Mel Gorman wrote: > for_each_cpu_wrap(cpu, cpus, target) { > - if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) > + if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) { > + /* Adjust cost of a successful scan */ > +

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2021-01-08 Thread Mel Gorman
On Tue, Dec 15, 2020 at 08:59:11AM +0100, Peter Zijlstra wrote: > On Tue, Dec 15, 2020 at 11:36:35AM +0800, Li, Aubrey wrote: > > On 2020/12/15 0:48, Peter Zijlstra wrote: > > > We compute the average cost of the total scan, but then use it as a > > > per-cpu scan cost when computing the scan

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2020-12-15 Thread Li, Aubrey
On 2020/12/15 15:59, Peter Zijlstra wrote: > On Tue, Dec 15, 2020 at 11:36:35AM +0800, Li, Aubrey wrote: >> On 2020/12/15 0:48, Peter Zijlstra wrote: >>> We compute the average cost of the total scan, but then use it as a >>> per-cpu scan cost when computing the scan proportion. Fix this by >>>

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2020-12-15 Thread Mel Gorman
On Tue, Dec 15, 2020 at 08:59:11AM +0100, Peter Zijlstra wrote: > On Tue, Dec 15, 2020 at 11:36:35AM +0800, Li, Aubrey wrote: > > On 2020/12/15 0:48, Peter Zijlstra wrote: > > > We compute the average cost of the total scan, but then use it as a > > > per-cpu scan cost when computing the scan

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2020-12-15 Thread Peter Zijlstra
On Tue, Dec 15, 2020 at 11:36:35AM +0800, Li, Aubrey wrote: > On 2020/12/15 0:48, Peter Zijlstra wrote: > > We compute the average cost of the total scan, but then use it as a > > per-cpu scan cost when computing the scan proportion. Fix this by > > properly computing a per-cpu scan cost. > > > >

Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2020-12-14 Thread Li, Aubrey
On 2020/12/15 0:48, Peter Zijlstra wrote: > We compute the average cost of the total scan, but then use it as a > per-cpu scan cost when computing the scan proportion. Fix this by > properly computing a per-cpu scan cost. > > This also fixes a bug where we would terminate early (!--nr, case) and

[RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting

2020-12-14 Thread Peter Zijlstra
We compute the average cost of the total scan, but then use it as a per-cpu scan cost when computing the scan proportion. Fix this by properly computing a per-cpu scan cost. This also fixes a bug where we would terminate early (!--nr, case) and not account that cost at all. Signed-off-by: Peter