Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1597861imm; Tue, 15 May 2018 23:41:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrZ5C0DPX1Nw1mojbTyugD2T8IhW4SXgfmkyG+LzXuPZUU1hWJO/JMZ0MsmRNiguGl9pA0a X-Received: by 2002:a17:902:5ac1:: with SMTP id g1-v6mr17887290plm.43.1526452883860; Tue, 15 May 2018 23:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526452883; cv=none; d=google.com; s=arc-20160816; b=tGDGxH442MKy9CQq8FmQSFpz7L8OUx3yOvd2JTZPXuwC39Ukk2yR4zKioKl+friEwq O8UaghOXA9zAGaCZwpdv2MzeNv7CiKxvbE8HzUughlhHUgrx76vUNxqENGxA48k3iYi6 QD0KcZxCqa1/TCK/0vIsZVNjyIal099xdFZUfqPzaFDRZausZek7Ua/FVSB4Oib/TNGA hVhG4HuOhyc1r7LFSqiBbDWOfdeXVbrRtUwjWjeoh7hI0lOtcC1nxk9TpboJIkrx7QnP x06+CZcFxN+SWv434g1REaoCGRTCEOQPi8ZEMDNfnVtf0q0OxX4v2922c725eNYkKHix 7lTg== 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=kLTNngQEsbvfKdh/IBZ6lZ1R0d8B75NdhxsQwLcPzP8=; b=0jNhdzupbEEMoivbNt9svTG0eg1CCpHG0Q94SpvotPcNO7zsDeO/oGcItJZuyQCCkP HG07t2SWKZX/E9VxnAf17ZA8EjsOEr4am4AmLA88xlRIICxnjOfRbTvJV4a+/yZDNdjX W/DG4AwC5RlywjXoZbLJNuJnNLc1mqpH3xUxFtb3p6t/cBsXaNpD0cb7wQCXOv1kKJKz DJjxHjlT13J5P9ya4F+qaZ/jaVhVHTfzDcNt1gEmW98NTy/NynrU7iYmZElTudFSMm9o bNv/VhE6pkyfgEDrkXnSgp6c4catF6xQ2QVugZuP6qadXJjF64eeY/Un+O9IR85cb3ga oVwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MNfv5w/e; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7-v6si1563577pgv.47.2018.05.15.23.41.09; Tue, 15 May 2018 23:41:23 -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=pass header.i=@linaro.org header.s=google header.b=MNfv5w/e; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752179AbeEPGlA (ORCPT + 99 others); Wed, 16 May 2018 02:41:00 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:33321 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751471AbeEPGk6 (ORCPT ); Wed, 16 May 2018 02:40:58 -0400 Received: by mail-pl0-f66.google.com with SMTP id n10-v6so1550738plp.0 for ; Tue, 15 May 2018 23:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kLTNngQEsbvfKdh/IBZ6lZ1R0d8B75NdhxsQwLcPzP8=; b=MNfv5w/eJoCfiYPtc/Zjg3tTXlRP738ubcNTUnA90ma7qnZmJikXpHBRU2b4RCfnHL DMZjzCzh1EAedDdqRTK9hf9IYpfYm0fbM9jXXLWj7UmU28EocNEdzQgaWgn/zUpIRx5j M15MJt9EyxvHrsqllUkwWi0MVYykK6DquecR4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kLTNngQEsbvfKdh/IBZ6lZ1R0d8B75NdhxsQwLcPzP8=; b=hWbM3Jx16AXni/+8oh9MLob8G4BjCmxk3ErKlFO5IwQZupkRrNP0CRPVefcMpjxuO3 fG/9ki9/KalxHD6cPcXtzqKrrbRpQTkORBAkQmNfrY+Q+vgjoF9kgADT5QJTfA97HXBG zg/CadCXXFhJXRnHyZUEMrogPW/udctdQa1B1o1eN8SQCOjKCbDpkQxJfftUlSrMA1nk CXhzal2+jtvLpo3JJO8VfjacgiFdJ0Ly8makVx4lnNCqwChMSRr69FfXbKRCXvTNiJop 0vEJUGJc5qE9E/8QkP53RuGIAmzz0q7ZF3rRnApAuZvR708munYGV7++UlA+G+n1zx5+ vxWw== X-Gm-Message-State: ALKqPwdwKUPIK9od5gXmpt7Ip8zNE/OoXLjtiq4Gj9/QE0odEUU/v7MM 5aNwLkRFXusQU3dCCWbTF/CkAA== X-Received: by 2002:a17:902:700a:: with SMTP id y10-v6mr17868567plk.265.1526452858199; Tue, 15 May 2018 23:40:58 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id i69-v6sm2855431pfk.84.2018.05.15.23.40.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 23:40:57 -0700 (PDT) Date: Wed, 16 May 2018 12:10:55 +0530 From: Viresh Kumar To: Srinivas Pandruvada Cc: tglx@linutronix.de, mingo@redhat.com, peterz@infradead.org, bp@suse.de, lenb@kernel.org, rjw@rjwysocki.net, mgorman@techsingularity.net, x86@kernel.org, linux-pm@vger.kernel.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: <20180516064055.gbmemcxsv2qvx67g@vireshk-i7> 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: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15-05-18, 21:49, Srinivas Pandruvada wrote: > Added cpufreq_get_sched_util() to get the CFS, DL and max utilization > values for a CPU. This is required for getting utilization values > for cpufreq drivers outside of kernel/sched folder. > > Signed-off-by: Srinivas Pandruvada > --- > include/linux/sched/cpufreq.h | 2 ++ > kernel/sched/cpufreq.c | 23 +++++++++++++++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h > index 5966744..a366600 100644 > --- a/include/linux/sched/cpufreq.h > +++ b/include/linux/sched/cpufreq.h > @@ -20,6 +20,8 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data, > void (*func)(struct update_util_data *data, u64 time, > unsigned int flags)); > void cpufreq_remove_update_util_hook(int cpu); > +void cpufreq_get_sched_util(int cpu, unsigned long *util_cfs, > + unsigned long *util_dl, unsigned long *max); > #endif /* CONFIG_CPU_FREQ */ > > #endif /* _LINUX_SCHED_CPUFREQ_H */ > diff --git a/kernel/sched/cpufreq.c b/kernel/sched/cpufreq.c > index 5e54cbc..36e2839 100644 > --- 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 What will happen when schedutil is compiled in the kernel but ondemand is the one getting used currently ? > + 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); > -- > 2.9.5 -- viresh