Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1404159 > unrolled thread
| Started by | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| First post | 2016-05-20 08:50 +0200 |
| Last post | 2016-05-20 13:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/2] cpufreq: Upstream Android's Interactive governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-05-20 08:50 +0200
[PATCH 1/2] cpufreq: Move gov_attr_* macros to cpufreq.h Viresh Kumar <viresh.kumar@linaro.org> - 2016-05-20 08:50 +0200
Re: [PATCH 0/2] cpufreq: Upstream Android's Interactive governor "Rafael J. Wysocki" <rafael@kernel.org> - 2016-05-20 13:30 +0200
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-05-20 08:50 +0200 |
| Subject | [PATCH 0/2] cpufreq: Upstream Android's Interactive governor |
| Message-ID | <rAMpY-25Y-15@gated-at.bofh.it> |
Hi Rafael et. al., We had some discussions [1] last week on the PM mailing about upstreaming the cpufreq governor most widely used on Andoid Mobile phones and tablets: Interactive governor. People (including Rafael) mostly agreed that we better get it upstreamed and here is an attempt to upstream most of it (idle notifiers aren't included in this series). I picked the latest code spread over 70-80 patches from [2]. The unmodified code, based over mainline is pushed [4] for reference. I have updated the governor to align it with the current practices followed with mainline governors, like using utilization hooks from the scheduler and handling kobject (for governor's sysfs directory) in a race free manner. And of course this included general cleanup of the governor as well. This version is pushed here [3] for testing. The Android version of interactive governor also uses idle EXIT notifiers, but that code isn't part of this series and will be sent separately later. For people interested in looking at that, those are 3 minor patches on top of this series and are pushed here [5]. I haven't changed the core logic of the governor intentionally, as that rather requires more in-depth knowledge of the use case for which the optimizations have been done. So, we should do any such thing later on with new patches, so that people can find things easily. I also haven't tried to change the userspace interface as that may have broken the userspace that already exists and uses this governor. This has been lightly tested on my Exynos board (dual ARM A15), where the governor gets inserted/removed multiple times, the sysfs files are all functional. The frequency gets changed with load, etc. This series is based of pm/bleeding-edge branch + few patches from Rafael [6] & [7] and few minor cleanups from me [8]. -- viresh [1] http://marc.info/?l=linux-pm&m=146301864519072 [2] https://android.googlesource.com/kernel/common remotes/android/android-4.4 [3] git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git cpufreq/interactive [4] git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git cpufreq/interactive-orig [5] git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git cpufreq/intearctive-idle-notifier [6] http://marc.info/?l=linux-kernel&m=146318036229244 [7] http://marc.info/?l=linux-kernel&m=146360498820804 [8] http://marc.info/?l=linux-pm&m=146357434108299 Viresh Kumar (2): cpufreq: Move gov_attr_* macros to cpufreq.h cpufreq: Add android's 'interactive' governor Documentation/cpu-freq/governors.txt | 86 ++ drivers/cpufreq/Kconfig | 27 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/cpufreq_governor.h | 8 - drivers/cpufreq/cpufreq_interactive.c | 1371 ++++++++++++++++++++++++++++ include/linux/cpufreq.h | 12 + include/trace/events/cpufreq_interactive.h | 112 +++ kernel/sched/cpufreq_schedutil.c | 8 +- 8 files changed, 1613 insertions(+), 12 deletions(-) create mode 100644 drivers/cpufreq/cpufreq_interactive.c create mode 100644 include/trace/events/cpufreq_interactive.h -- 2.7.1.410.g6faf27b
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-05-20 08:50 +0200 |
| Subject | [PATCH 1/2] cpufreq: Move gov_attr_* macros to cpufreq.h |
| Message-ID | <rAMpZ-25Y-41@gated-at.bofh.it> |
| In reply to | #1404159 |
These macros can be reused by governors which don't use the common
governor code present in cpufreq_governor.c and should be moved to the
relevant header.
Now that they are getting moved to the right header file, reuse them in
schedutil governor as well (that required rename of show/store
routines).
Also create gov_attr_wo() macro for write-only sysfs files, this will be
used by Interactive governor in a later patch.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq_governor.h | 8 --------
include/linux/cpufreq.h | 12 ++++++++++++
kernel/sched/cpufreq_schedutil.c | 8 ++++----
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index ef1037e9c92b..3196ed9c1c0a 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -70,14 +70,6 @@ static ssize_t show_##file_name \
return sprintf(buf, "%u\n", dbs_data->file_name); \
}
-#define gov_attr_ro(_name) \
-static struct governor_attr _name = \
-__ATTR(_name, 0444, show_##_name, NULL)
-
-#define gov_attr_rw(_name) \
-static struct governor_attr _name = \
-__ATTR(_name, 0644, show_##_name, store_##_name)
-
/* Common to all CPUs of a policy */
struct policy_dbs_info {
struct cpufreq_policy *policy;
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index fbd696edf5bd..533490cd046d 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -504,6 +504,18 @@ struct gov_attr_set {
int usage_count;
};
+#define gov_attr_ro(_name) \
+static struct governor_attr _name = \
+__ATTR(_name, 0444, show_##_name, NULL)
+
+#define gov_attr_wo(_name) \
+static struct governor_attr _name = \
+__ATTR(_name, 0200, NULL, store_##_name)
+
+#define gov_attr_rw(_name) \
+static struct governor_attr _name = \
+__ATTR(_name, 0644, show_##_name, store_##_name)
+
/* sysfs ops for cpufreq governors */
extern const struct sysfs_ops governor_sysfs_ops;
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 758efd7f3abe..cc77ce18e52c 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -243,15 +243,15 @@ static inline struct sugov_tunables *to_sugov_tunables(struct gov_attr_set *attr
return container_of(attr_set, struct sugov_tunables, attr_set);
}
-static ssize_t rate_limit_us_show(struct gov_attr_set *attr_set, char *buf)
+static ssize_t show_rate_limit_us(struct gov_attr_set *attr_set, char *buf)
{
struct sugov_tunables *tunables = to_sugov_tunables(attr_set);
return sprintf(buf, "%u\n", tunables->rate_limit_us);
}
-static ssize_t rate_limit_us_store(struct gov_attr_set *attr_set, const char *buf,
- size_t count)
+static ssize_t store_rate_limit_us(struct gov_attr_set *attr_set,
+ const char *buf, size_t count)
{
struct sugov_tunables *tunables = to_sugov_tunables(attr_set);
struct sugov_policy *sg_policy;
@@ -268,7 +268,7 @@ static ssize_t rate_limit_us_store(struct gov_attr_set *attr_set, const char *bu
return count;
}
-static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us);
+gov_attr_rw(rate_limit_us);
static struct attribute *sugov_attributes[] = {
&rate_limit_us.attr,
--
2.7.1.410.g6faf27b
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2016-05-20 13:30 +0200 |
| Message-ID | <rAQMV-4QX-7@gated-at.bofh.it> |
| In reply to | #1404159 |
On Fri, May 20, 2016 at 8:39 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote: > Hi Rafael et. al., > > We had some discussions [1] last week on the PM mailing about > upstreaming the cpufreq governor most widely used on Andoid Mobile > phones and tablets: Interactive governor. People (including Rafael) > mostly agreed that we better get it upstreamed and here is an attempt to > upstream most of it (idle notifiers aren't included in this series). > > I picked the latest code spread over 70-80 patches from [2]. The > unmodified code, based over mainline is pushed [4] for reference. > > I have updated the governor to align it with the current practices > followed with mainline governors, like using utilization hooks from the > scheduler and handling kobject (for governor's sysfs directory) in a > race free manner. And of course this included general cleanup of the > governor as well. This version is pushed here [3] for testing. > > The Android version of interactive governor also uses idle EXIT > notifiers, but that code isn't part of this series and will be sent > separately later. For people interested in looking at that, those are 3 > minor patches on top of this series and are pushed here [5]. > > I haven't changed the core logic of the governor intentionally, as that > rather requires more in-depth knowledge of the use case for which the > optimizations have been done. So, we should do any such thing later on > with new patches, so that people can find things easily. > > I also haven't tried to change the userspace interface as that may have > broken the userspace that already exists and uses this governor. > > This has been lightly tested on my Exynos board (dual ARM A15), where > the governor gets inserted/removed multiple times, the sysfs files are > all functional. The frequency gets changed with load, etc. > > This series is based of pm/bleeding-edge branch + few patches from > Rafael [6] & [7] and few minor cleanups from me [8]. OK, thanks! This may take some time to review, though.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web