Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1680606imm; Wed, 16 May 2018 01:14:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZozq0rsRsAoTjr22mC94FYyAr1bbwCkEQ0knRUVVig+lxpHnKlc4jHQQgyFacGS5TytBMiw X-Received: by 2002:a65:4309:: with SMTP id j9-v6mr15044085pgq.375.1526458460659; Wed, 16 May 2018 01:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526458460; cv=none; d=google.com; s=arc-20160816; b=zqX1ZcrJGj2YcCXgla+wpDe3+hpTfySYaQU2j6HE+K7prQcJ5RmQ8IysWQ1Z2suP0o aKDsVEAnQCo8OwCzYvJd+GZ4EFY8lhls91LA7dWv94xEQoCtn/ScwZa4EP31O09f/S1z t//2Nc3PH+3oQE4Epht/EbSTGwfCID7oMbEmr9PhlUBGpT0KmOsAAaqnlSxoGo1J8D12 KDx/47B4mYFv2b1QSi2oCeE1pfyb1UtZxST98zDcOWih/ZMTGnrJEjTPQYAEkYk91NEv q+76Yw30atHR99gIlRuwFcfnrjQUHwRSYM7hyvd1HEU4BXXjJZ+JZ2A3qBl7fOkm7DOh goMg== 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:arc-authentication-results; bh=zH8cNPrfutoMxLymzpbg2xLuYncNb161oErMSIKUdAA=; b=mr9jELtj8su60eZDKDn0SWhI7CeBsPOXCfyGvRnpy+pYZXVPbqfHmhT9OFOEWv/WVl KRA2yFu/A1JRdg0MMbOUhyEVEoapK7sWQpZpyJvvb6TM4YHqd8RZo0k1aUlUYi7pAINQ AZosuu2vf96kM8dIBkd/gsaTXDCtPWGZjoJex6vytGm5iS6A2pILjdjdmD/eMO8G4Vd+ ClbkU+KnIsTDbAtQq4vq5/yCzo+gESAApzuwfiCSENKUbE3ShhRy5ZQH+yUZAhpaj0Uy xHcbBwdnPPainLFMwICY3VmmlzC4o+/EEwNvOsee8Nd2wmSeTAqDLNLPjlpQXIZ3SNda gTbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=U6+3c/l1; 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 e191-v6si1678880pgc.233.2018.05.16.01.14.06; Wed, 16 May 2018 01:14:20 -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=U6+3c/l1; 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 S1752450AbeEPIMa (ORCPT + 99 others); Wed, 16 May 2018 04:12:30 -0400 Received: from merlin.infradead.org ([205.233.59.134]:36024 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395AbeEPIM2 (ORCPT ); Wed, 16 May 2018 04:12:28 -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=zH8cNPrfutoMxLymzpbg2xLuYncNb161oErMSIKUdAA=; b=U6+3c/l1S6aiFDGuKg6FBUvIy 1V6iPD0RLQmZeapdmlAYefs1hGR8tctCwii9IHJPdarX3y8I2NlevEYOpqgk9GNNTDuRJRaW5H+5S ZTXT8hS/E7r5xT3T0rqHafRez9VsEHF1SUInKpMXmLTXg+ceRlYWiulrddOj2rKXwMp4VLsbEjYHw vobUwBLG3LBoeMbDB4N5KJDDrtATEWjAnzU39l9/yERrAzbGDd7N7+wkKGh2XTaNEa7RriHuGCXhT 2bP/vWkaT0eU5AdKO+P3Y+oBPKXG6Bov0984RnqvLdfS58u1j45+s6OU/bPJvfJWffTDxvYkucyvf fcvC54l4g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIrXQ-0001rv-NR; Wed, 16 May 2018 08:11:57 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 17F532029F1C1; Wed, 16 May 2018 10:11:55 +0200 (CEST) Date: Wed, 16 May 2018 10:11:55 +0200 From: Peter Zijlstra To: Srinivas Pandruvada Cc: tglx@linutronix.de, mingo@redhat.com, bp@suse.de, lenb@kernel.org, rjw@rjwysocki.net, mgorman@techsingularity.net, x86@kernel.org, linux-pm@vger.kernel.org, viresh.kumar@linaro.org, juri.lelli@arm.com, linux-kernel@vger.kernel.org Subject: Re: [RFC/RFT] [PATCH 06/10] cpufreq / sched: Add interface to get utilization values Message-ID: <20180516081155.GA12217@hirez.programming.kicks-ass.net> References: <20180516044911.28797-1-srinivas.pandruvada@linux.intel.com> <20180516044911.28797-7-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180516044911.28797-7-srinivas.pandruvada@linux.intel.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 15, 2018 at 09:49:07PM -0700, Srinivas Pandruvada wrote: > --- a/kernel/sched/cpufreq.c > +++ b/kernel/sched/cpufreq.c > @@ -60,3 +60,26 @@ void cpufreq_remove_update_util_hook(int cpu) > rcu_assign_pointer(per_cpu(cpufreq_update_util_data, cpu), NULL); > } > EXPORT_SYMBOL_GPL(cpufreq_remove_update_util_hook); > + > +/** > + * cpufreq_get_sched_util - Get utilization values. > + * @cpu: The targeted CPU. > + * > + * Get the CFS, DL and max utilization. > + * This function allows cpufreq driver outside the kernel/sched to access > + * utilization value for a CPUs run queue. > + */ > +void cpufreq_get_sched_util(int cpu, unsigned long *util_cfs, > + unsigned long *util_dl, unsigned long *max) > +{ > +#ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL > + struct rq *rq = cpu_rq(cpu); > + > + *max = arch_scale_cpu_capacity(NULL, cpu); > + *util_cfs = cpu_util_cfs(rq); > + *util_dl = cpu_util_dl(rq); > +#else > + *util_cfs = *util_dl = 1; > +#endif > +} > +EXPORT_SYMBOL_GPL(cpufreq_get_sched_util); So I _really_ hate this... I'd much rather you make schedutil work with the hwp passive stuff. Also, afaict intel_pstate is bool, not tristate, so no need for an EXPORT at all.