From patchwork Mon Mar 14 05:22:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Turquette X-Patchwork-Id: 8576501 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D1DD29F758 for ; Mon, 14 Mar 2016 05:28:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EFBA72045A for ; Mon, 14 Mar 2016 05:28:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 177382042C for ; Mon, 14 Mar 2016 05:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754079AbcCNF1q (ORCPT ); Mon, 14 Mar 2016 01:27:46 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:36308 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933422AbcCNF0W (ORCPT ); Mon, 14 Mar 2016 01:26:22 -0400 Received: by mail-pa0-f52.google.com with SMTP id tt10so149508076pab.3 for ; Sun, 13 Mar 2016 22:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9H4er25zCMqhjnkWOjgGwXvnbvW9rY5zeLzEQ72uWws=; b=lR90oIe2h81CRfJMufA31niHe3GHjkWxP/9Ji/Zd4K2oq6vF0en/EavX0qq/lXE0Ta ki50la4z9EJZgdlcw8EHQCJsBFsgxklg8x+tn9/aOrW5OaegPhs8RWg0cKtAiMZeZMHD i41Vqs7SJZ9oNFqZOXJzZwiOH372fMVcXg0vt8/auRpVPl3vrtFehyUy68wGVsgHTa31 tYnuRUSvhpj0o2d7GKypTIPhDb3JuFD+mhJubeAMdCFF3uIutPFdvGNlmHPlUee858Ux NSZr71PUWsGQ2bCvZ+iPxGh44vYr7ctfpAOmgVNBj1pQFjN7eSa52tyURYxfS2pIfDvx 0oZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9H4er25zCMqhjnkWOjgGwXvnbvW9rY5zeLzEQ72uWws=; b=a39YMHwVOyJm2N4L1vY5m+diRHUFedo1Cfq9FVW5T7rKyiS0IjleaYLOK0g0GDmEv9 nJ56YzsD+gVRcxduyCFPDg3yjOBWp/qh5EN8Nm38ZS3majDkBIxH4T+d81FtVl/F/C1M qbRk7N5nIGA+pNo/d7hXaLqRHO5PY4PM7tlG0qY3YARoBJ6n3Hyz3HuFy6jqhDui2j6m IeF+GLglNayDtEm5pJpr6gVvUtbbpvHClWJcaBrK1aOBK+U84ujnQ+fjmCbIVaYf6Ezy RpSHVaATv7dVQ4hkrXIeZv5U2JpG1bSYg/5rYD/eZLrMuxefYJ9hc4n+AUO7uIGeaQwI DKxQ== X-Gm-Message-State: AD7BkJItmJrrBweEh/yr4PdICAfgSPz3AeKTLmKrxJYZrT+8JT9b8rUKoNkMF+Q9+Id2JH7Z X-Received: by 10.66.222.129 with SMTP id qm1mr34804639pac.22.1457933181712; Sun, 13 Mar 2016 22:26:21 -0700 (PDT) Received: from localhost (cpe-172-248-200-249.socal.res.rr.com. [172.248.200.249]) by smtp.gmail.com with ESMTPSA id h2sm28597287pfd.91.2016.03.13.22.26.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Mar 2016 22:26:20 -0700 (PDT) From: Michael Turquette X-Google-Original-From: Michael Turquette To: peterz@infradead.org, rjw@rjwysocki.net Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Juri.Lelli@arm.com, steve.muckle@linaro.org, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, Michael Turquette Subject: [PATCH 4/8] cpufreq/schedutil: sysfs capacity margin tunable Date: Sun, 13 Mar 2016 22:22:08 -0700 Message-Id: <1457932932-28444-5-git-send-email-mturquette+renesas@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457932932-28444-1-git-send-email-mturquette+renesas@baylibre.com> References: <1457932932-28444-1-git-send-email-mturquette+renesas@baylibre.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With the addition of the global cfs capacity margin helpers in patch, "sched/cpufreq: new cfs capacity margin helpers", we can now export sysfs tunables from the schedutil governor. This allows privileged users to tune the value more easily. The margin value is global to cfs, not per-policy. As such schedutil does not store any state about the margin. Schedutil restores the margin value to its default value when exiting. Signed-off-by: Michael Turquette --- drivers/cpufreq/cpufreq_schedutil.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/cpufreq/cpufreq_schedutil.c b/drivers/cpufreq/cpufreq_schedutil.c index 5aa26bf..12e49b9 100644 --- a/drivers/cpufreq/cpufreq_schedutil.c +++ b/drivers/cpufreq/cpufreq_schedutil.c @@ -246,8 +246,32 @@ static ssize_t rate_limit_us_store(struct gov_attr_set *attr_set, const char *bu static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us); +static ssize_t capacity_margin_show(struct gov_attr_set *not_used, + char *buf) +{ + return sprintf(buf, "%lu\n", cpufreq_get_cfs_capacity_margin()); +} + +static ssize_t capacity_margin_store(struct gov_attr_set *attr_set, + const char *buf, size_t count) +{ + unsigned long margin; + int ret; + + ret = sscanf(buf, "%lu", &margin); + if (ret != 1) + return -EINVAL; + + cpufreq_set_cfs_capacity_margin(margin); + + return count; +} + +static struct governor_attr capacity_margin = __ATTR_RW(capacity_margin); + static struct attribute *sugov_attributes[] = { &rate_limit_us.attr, + &capacity_margin.attr, NULL }; @@ -381,6 +405,7 @@ static int sugov_exit(struct cpufreq_policy *policy) mutex_lock(&global_tunables_lock); + cpufreq_reset_cfs_capacity_margin(); count = gov_attr_set_put(&tunables->attr_set, &sg_policy->tunables_hook); policy->governor_data = NULL; if (!count)