Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1644831 > unrolled thread
| Started by | Joel Fernandes <joelaf@google.com> |
|---|---|
| First post | 2017-05-18 20:40 +0200 |
| Last post | 2017-05-19 07:00 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/2] sched: Use iowait boost policy option in schedutil Joel Fernandes <joelaf@google.com> - 2017-05-18 20:40 +0200
Re: [PATCH 2/2] sched: Use iowait boost policy option in schedutil "Rafael J. Wysocki" <rafael@kernel.org> - 2017-05-19 03:10 +0200
Re: [PATCH 2/2] sched: Use iowait boost policy option in schedutil Joel Fernandes <joelaf@google.com> - 2017-05-19 03:20 +0200
Re: [PATCH 2/2] sched: Use iowait boost policy option in schedutil "Rafael J. Wysocki" <rafael@kernel.org> - 2017-05-19 06:30 +0200
Re: [PATCH 2/2] sched: Use iowait boost policy option in schedutil Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-19 06:40 +0200
Re: [PATCH 2/2] sched: Use iowait boost policy option in schedutil Joel Fernandes <joelaf@google.com> - 2017-05-19 07:00 +0200
Re: [PATCH 2/2] sched: Use iowait boost policy option in schedutil Joel Fernandes <joelaf@google.com> - 2017-05-19 07:00 +0200
| From | Joel Fernandes <joelaf@google.com> |
|---|---|
| Date | 2017-05-18 20:40 +0200 |
| Subject | [PATCH 2/2] sched: Use iowait boost policy option in schedutil |
| Message-ID | <tIyv7-6vH-7@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2017-05-19 03:10 +0200 |
| Message-ID | <tIEAx-31W-5@gated-at.bofh.it> |
| In reply to | #1644831 |
On Thu, May 18, 2017 at 8:30 PM, Joel Fernandes <joelaf@google.com> wrote:
> 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;
Well, that's just
tunables->iowait_boost_enable = policy->iowait_boost_enable;
so I'm not sure about the role of the if ().
Also, do we only need the policy field as an initial value here?
That's sort of confusing, because intel_pstate does iowait boosting in
the active mode too and then it is unconditional.
> +
> policy->governor_data = sg_policy;
> sg_policy->tunables = tunables;
>
> --
> 2.13.0.303.g4ebf302169-goog
Thanks,
Rafael
[toc] | [prev] | [next] | [standalone]
| From | Joel Fernandes <joelaf@google.com> |
|---|---|
| Date | 2017-05-19 03:20 +0200 |
| Message-ID | <tIEKd-35n-3@gated-at.bofh.it> |
| In reply to | #1644997 |
Hi Rafael,
On Thu, May 18, 2017 at 6:08 PM, Rafael J. Wysocki <rafael@kernel.org> wrote:
[..]
>> 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;
>
> Well, that's just
>
> tunables->iowait_boost_enable = policy->iowait_boost_enable;
>
> so I'm not sure about the role of the if ().
Yes you're right, will fix.
>
> Also, do we only need the policy field as an initial value here?
> That's sort of confusing, because intel_pstate does iowait boosting in
> the active mode too and then it is unconditional.
>
I didn't get your comment. Could you clarify what you meant by
'intel_pstate does iowait boosting in the active mode' ? Is there
another path outside the governor where intel_pstate does iowait
boosting, or are you referring to the hardware behavior?
thanks,
-Joel
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2017-05-19 06:30 +0200 |
| Message-ID | <tIHI6-582-7@gated-at.bofh.it> |
| In reply to | #1644999 |
On Fri, May 19, 2017 at 3:17 AM, Joel Fernandes <joelaf@google.com> wrote:
> Hi Rafael,
>
> On Thu, May 18, 2017 at 6:08 PM, Rafael J. Wysocki <rafael@kernel.org> wrote:
> [..]
>>> 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;
>>
>> Well, that's just
>>
>> tunables->iowait_boost_enable = policy->iowait_boost_enable;
>>
>> so I'm not sure about the role of the if ().
>
> Yes you're right, will fix.
>
>>
>> Also, do we only need the policy field as an initial value here?
>> That's sort of confusing, because intel_pstate does iowait boosting in
>> the active mode too and then it is unconditional.
>>
>
> I didn't get your comment. Could you clarify what you meant by
> 'intel_pstate does iowait boosting in the active mode' ? Is there
> another path outside the governor where intel_pstate does iowait
> boosting,
Yes.
> or are you referring to the hardware behavior?
No.
In the active mode intel_pstate acts as a governor too and it does
iowait boosting unconditionally then.
But that's OK on a second thought, as the policy field will affect the
passive mode only anyway and setting it on init will actually cause
the behavior to be consistent.
Thanks,
Rafael
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-05-19 06:40 +0200 |
| Message-ID | <tIHRM-5c6-3@gated-at.bofh.it> |
| In reply to | #1644831 |
On Fri, May 19, 2017 at 12:00 AM, Joel Fernandes <joelaf@google.com> wrote:
> 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).
As I understand it, you want to make iowait boost optional. It may be worth
mentioning why we want to do that in the commit somewhere. I am quite sure
you don't want for some of the ARM platforms. Can you please elaborate?
PeterZ once indicated that he is against adding any tunables for the schedutil
governor. This is another one we have now.
> 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;
Maybe just:
bool iowait_boost;
> };
>
> struct sugov_policy {
> @@ -47,6 +48,7 @@ struct sugov_policy {
> bool work_in_progress;
>
> bool need_freq_update;
> + unsigned int iowait_boost_enable;
I don't see this being used at all. Am I missing something ?
> };
>
> 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
>
[toc] | [prev] | [next] | [standalone]
| From | Joel Fernandes <joelaf@google.com> |
|---|---|
| Date | 2017-05-19 07:00 +0200 |
| Message-ID | <tIIb7-5kI-1@gated-at.bofh.it> |
| In reply to | #1645196 |
On Thu, May 18, 2017 at 9:39 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
[..]
>> 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;
>
> Maybe just:
>
> bool iowait_boost;
Yes, Rafael mentioned this for the cpufreq framework part, I will do
it this way in v2.
>
>> };
>>
>> struct sugov_policy {
>> @@ -47,6 +48,7 @@ struct sugov_policy {
>> bool work_in_progress;
>>
>> bool need_freq_update;
>> + unsigned int iowait_boost_enable;
>
> I don't see this being used at all. Am I missing something ?
>
Ah! Yes you're right, this is spurious, I will drop it. Thanks for spotting it.
-Joel
[toc] | [prev] | [next] | [standalone]
| From | Joel Fernandes <joelaf@google.com> |
|---|---|
| Date | 2017-05-19 07:00 +0200 |
| Message-ID | <tIIb8-5kI-3@gated-at.bofh.it> |
| In reply to | #1645196 |
On Thu, May 18, 2017 at 9:39 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote: > On Fri, May 19, 2017 at 12:00 AM, Joel Fernandes <joelaf@google.com> wrote: >> 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). > > As I understand it, you want to make iowait boost optional. It may be worth > mentioning why we want to do that in the commit somewhere. I am quite sure > you don't want for some of the ARM platforms. Can you please elaborate? Yes, I actually have power measurements too which I will include in v2. This is for an arm64 based Qualcomm SoC. thanks, -Joel
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web