Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3519753ybi; Tue, 18 Jun 2019 02:04:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzojP0Ef20vlNwqbgCkrb4YkC0H+2Ua0xMBC9aN28pkx9p9yZltFMPCR69H+pvZ/OWWsHnF X-Received: by 2002:a62:36c1:: with SMTP id d184mr122016009pfa.49.1560848688641; Tue, 18 Jun 2019 02:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560848688; cv=none; d=google.com; s=arc-20160816; b=0l/AImYTpX6ISQKua5DQt3dVRRkEPvG/b5e6kViLOi4WTuCzOUnJg+/Dlohabk4oA3 kaoW9eeurX2DwRL+5vMSGKQABk81ff08zwwNyP5b3ad8dbEbQEdWsV0vAgnvq8R8nD09 56uR8KHyKob7LC5cDJInfVZwnWJ5OBUAXm2w7eysHif5o2ox1CKboIo7LFHsMv+3Wxga dBr1x5iUK1AFyT3Vt4mQ42F85+NC1MV6IY8tLDBne0hY7PvTzkxyA+P1Ug5m4XMq8RhI PH2KBrjjCmajnk4NDUI+QR17EeLz7VdY0sWUO4qWztGmlIl2pLTxUeEwTc3dJ3c5wYg4 HInQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NKXGTn/8jB7RCZRASoJ1qXu3OCpTArWgI9rjBmJJd6I=; b=eTDMClXkdObTDi7Ozm1HdL48pI40d2MGueQIlBbCHRPKfCK4GQ+OXl5e/duv+QRWu6 HMJU0FKvXSKdRsUOoDv66NSkpgAcTyrF0/0Nu5txv1Cbb4q7I4HWTf65VMMNtfAkJqsM Jni+FI9ys8S/cWoQLbOjQ/XV1rsjGrXugWz4cVm/VEvkFcFgXVT8mcLR+gZIkllLwuNJ 5lzw0BjS22P0FU6+DmISmeBFN0iTbROi7aYvXqp+3jO33NV5Ylm+bq89grvRo3sUvAT6 Ja6yjMOfNTejjHYJpLOTO3vQ4k048O2BEVQHBwsNNRlYP9mNOiPCcfiVzo/dF8wW83Qy 8J4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si11982678pll.433.2019.06.18.02.04.30; Tue, 18 Jun 2019 02:04:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729131AbfFRJCp (ORCPT + 99 others); Tue, 18 Jun 2019 05:02:45 -0400 Received: from foss.arm.com ([217.140.110.172]:58088 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728754AbfFRJCp (ORCPT ); Tue, 18 Jun 2019 05:02:45 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 64697360; Tue, 18 Jun 2019 02:02:44 -0700 (PDT) Received: from queper01-lin (queper01-lin.cambridge.arm.com [10.1.195.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7BA453F246; Tue, 18 Jun 2019 02:02:43 -0700 (PDT) Date: Tue, 18 Jun 2019 10:02:42 +0100 From: Quentin Perret To: "Rafael J. Wysocki" Cc: Viresh Kumar , Peter Zijlstra , Ingo Molnar , Linux Kernel Mailing List , Vincent Guittot Subject: Re: [PATCH] sched/fair: Introduce fits_capacity() Message-ID: <20190618090239.a4prlefzpc27gwve@queper01-lin> References: <20190605091644.w3g7hc7r3eiscz4f@queper01-lin> <20190606025204.qe5v7j6fysjkgxc6@vireshk-i7> <20190617150204.GG3436@hirez.programming.kicks-ass.net> <20190618031217.63md32da5pzydqia@vireshk-i7> <20190618074728.gf6wugkbndhhcqql@vireshk-i7> <20190618082553.tonhmthyy6mo3iui@queper01-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 18 Jun 2019 at 10:36:56 (+0200), Rafael J. Wysocki wrote: > On Tue, Jun 18, 2019 at 10:25 AM Quentin Perret wrote: > > > > On Tuesday 18 Jun 2019 at 10:10:48 (+0200), Rafael J. Wysocki wrote: > > > On Tue, Jun 18, 2019 at 9:47 AM Viresh Kumar wrote: > > > > > > > > On 18-06-19, 09:26, Rafael J. Wysocki wrote: > > > > > On Tue, Jun 18, 2019 at 5:12 AM Viresh Kumar wrote: > > > > > > > > > > > > +Rafael > > > > > > > > > > > > On 17-06-19, 17:02, Peter Zijlstra wrote: > > > > > > > On Thu, Jun 06, 2019 at 08:22:04AM +0530, Viresh Kumar wrote: > > > > > > > > Hmm, even if the values are same currently I am not sure if we want > > > > > > > > the same for ever. I will write a patch for it though, if Peter/Rafael > > > > > > > > feel the same as you. > > > > > > > > > > > > > > Is it really the same variable or just two numbers that happen to be the > > > > > > > same? > > > > > > > > > > > > In both cases we are trying to keep the load under 80% of what can be supported. > > > > > > But I am not sure of the answer to your question. > > > > > > > > > > > > Maybe Rafael knows :) > > > > > > > > > > Which variable? > > > > > > > > Schedutil multiplies the target frequency by 1.25 (20% more capacity eventually) > > > > to get enough room for more load and similar thing is done in fair.c at several > > > > places to see if the new task can fit in a runqueue without overloading it. > > > > > > For the schedutil part, see the changelog of the commit that introduced it: > > > > > > 9bdcb44e391d cpufreq: schedutil: New governor based on scheduler > > > utilization data > > > > > > As for the other places, I don't know about the exact reasoning. > > > > > > > Quentin suggested to use common code for this calculation and that is what is > > > > getting discussed here. > > > > > > I guess if the rationale for the formula is the same in all cases, it > > > would be good to consolidate that code and document the rationale > > > while at it. > > > > I _think_ it is, but I guess others could correct me if this is > > incorrect. > > > > When choosing a CPU or a frequency using a util value, we look for a > > capacity that will provide us with 20% of idle time. And in both case we > > use the same threshold, just hardcoded in different places. Hence the > > suggestion to unify things. > > > > I hope that makes sense :-) > > Well, for schedutil, the 1.25 value comes from the case when > utilization is not frequency-invariant the next-frequency formula is > recursive (the next frequency is proportional to the current one). It > is chosen to get the new frequency equal to the old one if (util / > max) is .8. That translates to the "capacity that will provide 20% > more of idle time" in the frequency-invariant utilization case, but > the original rationale was different. OK, thanks, I wasn't aware of this. I understood it the other way around, but re-reading the commit message you shared earlier this makes sense. I guess it is also worth mentioning that, to the best of my knowledge, the vast majority of real-world sugov users are in fact frequency invariant. So perhaps there is still a case for the code factorization suggested earlier. But in the end it is really just a cleanup to help maintainability, so if you guys don't buy in there is no point pushing further :-) Thanks, Quentin