Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2586082imm; Wed, 16 May 2018 15:41:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoH/apBhqU4YPHmXaqRw5S1cHq66qJjD60dQt04V5BWhGNGy5EvUAk6S1s5dIExyuqMZSAe X-Received: by 2002:a65:4309:: with SMTP id j9-v6mr2133553pgq.375.1526510473854; Wed, 16 May 2018 15:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526510473; cv=none; d=google.com; s=arc-20160816; b=T9FWzGqX+qPAJ5jG6Kmukdz14wipi7xXOTCMinccjUMPzpZ5UWqYckPNgpUqqjvTvj b/BqERvhrTGRFU5UdQw7+vvXjmtLzPpaHRBFzmWy3NeXM1o0g0FJo81dtUQ8mqMFHUEd KaFL5Hjft2CVZNZs9AK8g5qWMZKsCd59ntye6PN+P3n+Z5K8m/AEibs9MNfucbezsJPt zzl81lfP695mVOMW04jNf/b6ZNeYwjYlQM67i55O46nMsmK7wzepVJi4/7x5r1keYkz9 SAEaduVv8lh4KqoOz/IL+X+cCbrvNWxqcJRHJlDEPJYUDjSiaK0ss+3smhCDAdeBKsZK NAFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=6BVEk1GR6d8c9mmm3Yie5Ye1kSk2LCsu6RaSuK8CMSM=; b=GDQT/CO/deFf7ZshROFpaZTgZOOmoZYedP/mFXrbIa8wSdUPwv2xv7Zk13eCkcCQAn krpHuZHXXV41VkpN0bqathvQ80pK0RmVVMOTg25BBTgHwPWIhuhyI8q7lAEu3GmBVFGG TKsIt8VeyHeWwhE82irH+AtFj+6aEQAnWthX5z6sXoHOKNmks7tNtGIAIQVYYnvHQQbS eN3J4U3WyyfnPsLw2k2ZqAyrnoX2/a+n8Q/h4NOuG9sxFAmqDYbUSJpa+yYO7X3ZAh/O 5pgj1B+jyUW3zhTjY/srRrmZuWmzCtgBhz6H4yVYjS65cwTFb9iVLICeY2JBTDB2YIz1 /5kg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k33-v6si3598311pld.100.2018.05.16.15.40.56; Wed, 16 May 2018 15:41:13 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751510AbeEPWkp (ORCPT + 99 others); Wed, 16 May 2018 18:40:45 -0400 Received: from mga04.intel.com ([192.55.52.120]:53564 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbeEPWko (ORCPT ); Wed, 16 May 2018 18:40:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2018 15:40:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,407,1520924400"; d="scan'208";a="42400844" Received: from spandruv-desk.jf.intel.com ([10.54.75.31]) by orsmga006.jf.intel.com with ESMTP; 16 May 2018 15:40:39 -0700 Message-ID: <1526510439.61700.109.camel@linux.intel.com> Subject: Re: [RFC/RFT] [PATCH 06/10] cpufreq / sched: Add interface to get utilization values From: Srinivas Pandruvada To: Peter Zijlstra 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 Date: Wed, 16 May 2018 15:40:39 -0700 In-Reply-To: <20180516081155.GA12217@hirez.programming.kicks-ass.net> References: <20180516044911.28797-1-srinivas.pandruvada@linux.intel.com> <20180516044911.28797-7-srinivas.pandruvada@linux.intel.com> <20180516081155.GA12217@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.6 (3.24.6-1.fc26) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-05-16 at 10:11 +0200, Peter Zijlstra wrote: > 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. Are you not happy with ifdefs are utility function itself? Can you explain more how this should be done? utilization values are not passed with scheduler update util callback. So need to have access to rq->cfs.avg.util* and rq->dl.running_bw access from intel_pstate. The ifdefs can be removed, if we remove ifdefs for cpu_util_dl() or cpu_util_cfs(), which are not doing anything special other than accessing rq->cfs.avg.util* and rq->dl.running_bw. I think it is better to remove from these functions. > > Also, afaict intel_pstate is bool, not tristate, so no need for an > EXPORT at all. Correct. I am just following other interface functions for sched util hooks in this file which are using EXPORT. But I will remove EXPORT in the next revision. Thanks, Srinivas