mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelaf@google.com>
To: linux-kernel@vger.kernel.org
Cc: rafael@kernel.org, Joel Fernandes <joelaf@google.com>
Subject: [PATCH 2/2] sched: Use iowait boost policy option in schedutil
Date: Thu, 18 May 2017 11:30:20 -0700	[thread overview]
Message-ID: <20170518183020.6188-2-joelaf@google.com> (raw)
In-Reply-To: <20170518183020.6188-1-joelaf@google.com>

If cpufreq policy has iowait boost enabled, use it. Also make it a schedutil
configuration from sysfs so it can be turned on/off if needed (by default use
the policy value).

Signed-off-by: Joel Fernandes <joelaf@google.com>
---
 kernel/sched/cpufreq_schedutil.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 76877a62b5fa..6915925bc947 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -24,6 +24,7 @@
 struct sugov_tunables {
 	struct gov_attr_set attr_set;
 	unsigned int rate_limit_us;
+	unsigned int iowait_boost_enable;
 };
 
 struct sugov_policy {
@@ -47,6 +48,7 @@ struct sugov_policy {
 	bool work_in_progress;
 
 	bool need_freq_update;
+	unsigned int iowait_boost_enable;
 };
 
 struct sugov_cpu {
@@ -171,6 +173,11 @@ static void sugov_get_util(unsigned long *util, unsigned long *max)
 static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time,
 				   unsigned int flags)
 {
+	struct sugov_policy *sg_policy = sg_cpu->sg_policy;
+
+	if (!sg_policy->tunables->iowait_boost_enable)
+		return;
+
 	if (flags & SCHED_CPUFREQ_IOWAIT) {
 		sg_cpu->iowait_boost = sg_cpu->iowait_boost_max;
 	} else if (sg_cpu->iowait_boost) {
@@ -386,10 +393,34 @@ static ssize_t rate_limit_us_store(struct gov_attr_set *attr_set, const char *bu
 	return count;
 }
 
+static ssize_t iowait_boost_enable_show(struct gov_attr_set *attr_set,
+					char *buf)
+{
+	struct sugov_tunables *tunables = to_sugov_tunables(attr_set);
+
+	return sprintf(buf, "%u\n", tunables->iowait_boost_enable);
+}
+
+static ssize_t iowait_boost_enable_store(struct gov_attr_set *attr_set,
+					 const char *buf, size_t count)
+{
+	struct sugov_tunables *tunables = to_sugov_tunables(attr_set);
+	unsigned int enable;
+
+	if (kstrtouint(buf, 10, &enable))
+		return -EINVAL;
+
+	tunables->iowait_boost_enable = enable;
+
+	return count;
+}
+
 static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us);
+static struct governor_attr iowait_boost_enable = __ATTR_RW(iowait_boost_enable);
 
 static struct attribute *sugov_attributes[] = {
 	&rate_limit_us.attr,
+	&iowait_boost_enable.attr,
 	NULL
 };
 
@@ -543,6 +574,9 @@ static int sugov_init(struct cpufreq_policy *policy)
 			tunables->rate_limit_us *= lat;
 	}
 
+	if (policy->iowait_boost_enable)
+		tunables->iowait_boost_enable = policy->iowait_boost_enable;
+
 	policy->governor_data = sg_policy;
 	sg_policy->tunables = tunables;
 
-- 
2.13.0.303.g4ebf302169-goog

  reply	other threads:[~2017-05-18 18:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 18:30 [PATCH 1/2] cpufreq: Make iowait boost a policy option Joel Fernandes
2017-05-18 18:30 ` Joel Fernandes [this message]
2017-05-19  1:08   ` [PATCH 2/2] sched: Use iowait boost policy option in schedutil Rafael J. Wysocki
2017-05-19  1:17     ` Joel Fernandes
2017-05-19  4:22       ` Rafael J. Wysocki
2017-05-19  4:39   ` Viresh Kumar
2017-05-19  4:56     ` Joel Fernandes
2017-05-19  4:59     ` Joel Fernandes
2017-05-19  1:03 ` [PATCH 1/2] cpufreq: Make iowait boost a policy option Rafael J. Wysocki
2017-05-19  1:24   ` Joel Fernandes
2017-05-19  4:17 ` Viresh Kumar
2017-05-19  5:00   ` Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170518183020.6188-2-joelaf@google.com \
    --to=joelaf@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome