Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1739426ybn; Thu, 26 Sep 2019 01:14:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzQAWfnJ2n+mt/QI7shkIYTWSRKQ6jA5K7+G2Y2UsxEQiMBdLAejP1OeQGxvMqMzV1g+8p X-Received: by 2002:a05:6402:1a4c:: with SMTP id bf12mr2190539edb.277.1569485687134; Thu, 26 Sep 2019 01:14:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569485687; cv=none; d=google.com; s=arc-20160816; b=0Hhtq+GJgcnYGWhrj2EWPF4Fcn98VN02/DR3ijPKCPvf8eHbAgvxrjB7jaA8s++4bh DjYtmdsZ/VnL+faXdq8L5ADSaKrCsGkorUV1n4rXmABmpkjrueEIZZbY1dRyxCyA0zBG M6DoD3EnIC6MmG6EAQhxokouBf6ggATEOjVtzbWPXJZw9leKXx63Hr48Xa58AWNckXmw o72EdmWAdbHbx5dIWvEzBKD4WXrC3aFb+x9vT0MpiPBB3ybOhI+G/cdFpOnc31ogG2kT b/Z7npT9au9zmthrxqMTupijNuP/IfXEytMuMA52i7lhF9WXr7PfEnittiJ3k3XMHoN9 pk1w== 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:dkim-signature; bh=OCd9Fr0CJ9gkQjtYi+RvQr2AUrWhMG1/VlZsM2oF7Yc=; b=lWRSbnnx6eoiZc7agge02Wkf0edZDqOnuKaSOOPXC00jH2Xor4hNp/J/yvSsq/K9KX fJJ8jpvNAAH1WUCdSwB0Bt82YfCeIYQVrxpRmKDHpOIaz9hBXUjmVR+IJ2lPd7fuTVpv /2vixHMwaYQEFuQTLaeVZtFVZ8GNAKVIKmhbX0lzhc6fndFvBNpKrhie1Ji5+At4Zred yECJmkhbiEZtFVhdLjdzEbXyWXwq5HTxmxCp19w4TKZoDOZAUpRMUXiulfwh/qhon+SX bEW9VKF0TOxYrkM1Ifl1A5BUeVbV6AJb0Pi/YdpwxaG/Sb094dVJpIqEfU02wPkmLZHn YbDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=cu5yI+Wu; 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 j14si611344ejf.53.2019.09.26.01.14.23; Thu, 26 Sep 2019 01:14:47 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=cu5yI+Wu; 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 S2394038AbfIXOEI (ORCPT + 99 others); Tue, 24 Sep 2019 10:04:08 -0400 Received: from merlin.infradead.org ([205.233.59.134]:49144 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727557AbfIXOEI (ORCPT ); Tue, 24 Sep 2019 10:04:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OCd9Fr0CJ9gkQjtYi+RvQr2AUrWhMG1/VlZsM2oF7Yc=; b=cu5yI+WuhPe37UB2o0iJ7Qx5Q 5odWybKsCWzA9tcyVGj3aBSDl69PhcCVf25E9LobhN3SkxSMbEyEIZrPoy3j/F/Sf5G1DdQIXUVnA +G2dS+VpOCXkuT9vjYjPH2f6653yBReJGhANNnaO782eRAJSF6A5zBSfzdJmM6p9hTy+ycraszids M/614TxQzRc8ILxTr59o29o/O5HQAIVao5jwyE/mwNKSxgMbAKv+4+nxUsw+SgCN2ML9FjCz8bh90 EjlfLHPW/eg4iOibq3MPQrEpDHXcoaQEUiorXfaB8LkOFmTxG6FHFsGwjzAUzLlbevs89HQzV/qQW bFTvVXZgg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iClPj-0001cm-LP; Tue, 24 Sep 2019 14:03:35 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CCF4A305E35; Tue, 24 Sep 2019 16:02:46 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6803620D83757; Tue, 24 Sep 2019 16:03:32 +0200 (CEST) Date: Tue, 24 Sep 2019 16:03:32 +0200 From: Peter Zijlstra To: Giovanni Gherdovich Cc: Quentin Perret , srinivas.pandruvada@linux.intel.com, tglx@linutronix.de, mingo@redhat.com, bp@suse.de, lenb@kernel.org, rjw@rjwysocki.net, x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, mgorman@techsingularity.net, matt@codeblueprint.co.uk, viresh.kumar@linaro.org, juri.lelli@redhat.com, pjt@google.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com Subject: Re: [PATCH 1/2] x86,sched: Add support for frequency invariance Message-ID: <20190924140332.GL2369@hirez.programming.kicks-ass.net> References: <20190909024216.5942-1-ggherdovich@suse.cz> <20190909024216.5942-2-ggherdovich@suse.cz> <20190914105708.GA12877@qperret.net> <1568730466.3329.4.camel@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1568730466.3329.4.camel@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 17, 2019 at 04:27:46PM +0200, Giovanni Gherdovich wrote: > Hello Quentin, > > On Sat, 2019-09-14 at 12:57 +0200, Quentin Perret wrote: > > Hi Giovanni > > > > On Monday 09 Sep 2019 at 04:42:15 (+0200), Giovanni Gherdovich wrote: > > > +static inline long arch_scale_freq_capacity(int cpu) > > > +{ > > > + if (static_cpu_has(X86_FEATURE_APERFMPERF)) > > > + return per_cpu(arch_cpu_freq, cpu); > > > > So, if this is conditional, perhaps you could also add this check in an > > x86-specific implementation of arch_scale_freq_invariant() ? That would > > guide sugov in the right path (see get_next_freq()) if APERF/MPERF are > > unavailable. > > > > > + return 1024 /* SCHED_CAPACITY_SCALE */; > > > +} > > > > Good remark. If the cpu doesn't have APERF/MPERF, the choice here is that > freq_curr is constantly equal to freq_max, and the scaling factor is 1 all the > time. > > But I'm checking this static_cpu_has() every time I do a frequency update; > arguably schedutil should be smarter and settle such a case once and for all > at boot time. > > I'll check what's the cost of static_cpu_has() and if it's non-negligible I'll > do what you suggest (x86-specific version of arch_scale_freq_invariant(). static_cpu_has() is an alternative and ends up being a static branch (similar to static_key) once the alternative patching runs.