Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbcLEIuf (ORCPT ); Mon, 5 Dec 2016 03:50:35 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:45305 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998AbcLEIud (ORCPT ); Mon, 5 Dec 2016 03:50:33 -0500 Date: Mon, 5 Dec 2016 09:48:56 +0100 From: Peter Zijlstra To: Morten Rasmussen Cc: Vincent Guittot , mingo@kernel.org, linux-kernel@vger.kernel.org, matt@codeblueprint.co.uk, dietmar.eggemann@arm.com, kernellwp@gmail.com, yuyang.du@intel.com, umgwanakikbuti@gmail.com Subject: Re: [PATCH 1/2 v2] sched: fix find_idlest_group for fork Message-ID: <20161205084856.GR3092@twins.programming.kicks-ass.net> References: <1480088073-11642-1-git-send-email-vincent.guittot@linaro.org> <1480088073-11642-2-git-send-email-vincent.guittot@linaro.org> <20161129105758.GA1716@e105550-lin.cambridge.arm.com> <20161129114243.GF3092@twins.programming.kicks-ass.net> <20161129144609.GB1716@e105550-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161129144609.GB1716@e105550-lin.cambridge.arm.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1362 Lines: 32 On Tue, Nov 29, 2016 at 02:46:10PM +0000, Morten Rasmussen wrote: > On Tue, Nov 29, 2016 at 12:42:43PM +0100, Peter Zijlstra wrote: > > On Tue, Nov 29, 2016 at 10:57:59AM +0000, Morten Rasmussen wrote: > > > > @@ -5708,13 +5708,6 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t > > > > > > > > avg_cost = this_sd->avg_scan_cost; > > > > > > > > - /* > > > > - * Due to large variance we need a large fuzz factor; hackbench in > > > > - * particularly is sensitive here. > > > > - */ > > > > - if ((avg_idle / 512) < avg_cost) > > > > - return -1; > > > > - > The last bit that isn't clear to me is whether /512 is a 'large' fuzz > factor. I guess it is, as we can have many wake-ups, i.e. many times > avg_cost, over the period where avg_idle is calculated. No? So the idea was to not spend more time looking for work than we're actually going to be idle for, since then we're wasting time we could've done work. So avg_idle and avg_cost are equal measure in that the immediate inequality would be: if (avg_idle < avg_cost) stop(). Of course, both being averages with unknown distribution makes that a tricky proposition, and that also makes the 512 hard to quantify. Still a factor of 512 of the total average, where our variable cannot go negative (negative time intervals are nonsensical), is fairly large.