Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1483109 > unrolled thread

[PATCH V2 0/2] cpufreq: Upstream Android's Interactive governor

Started byViresh Kumar <viresh.kumar@linaro.org>
First post2016-09-14 11:00 +0200
Last post2016-09-14 11:00 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH V2 0/2] cpufreq: Upstream Android's Interactive governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-09-14 11:00 +0200
    [PATCH V2 1/2] cpufreq: Move gov_attr_* macros to cpufreq.h Viresh Kumar <viresh.kumar@linaro.org> - 2016-09-14 11:00 +0200

#1483109 — [PATCH V2 0/2] cpufreq: Upstream Android's Interactive governor

FromViresh Kumar <viresh.kumar@linaro.org>
Date2016-09-14 11:00 +0200
Subject[PATCH V2 0/2] cpufreq: Upstream Android's Interactive governor
Message-ID<shecV-76W-3@gated-at.bofh.it>
Hi Rafael et. al.,

We had some discussions [1] earlier on the PM mailing about
upstreaming the cpufreq governor most widely used on Android 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 fix regressions 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.

Amit Pundir (Linaro) has done extensive testing with Android and
compared results of both Original Interactive governor and the modified
one (in this series) and found them to be comparable.

This series is based of pm/bleeding-edge branch.

V1->V2:
- Changes to fix compilation issues with latest mainline
- Timer APIs got updated
 - s/mod_timer_pinned/mod_timer
 - s/init_timer/init_timer_pinned
- Updated prototypes of cpufreq_frequency_table_target() and
  update_util_handler()

--
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

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                    |   30 +
 drivers/cpufreq/Makefile                   |    1 +
 drivers/cpufreq/cpufreq_governor.h         |    8 -
 drivers/cpufreq/cpufreq_interactive.c      | 1363 ++++++++++++++++++++++++++++
 include/linux/cpufreq.h                    |   12 +
 include/trace/events/cpufreq_interactive.h |  112 +++
 kernel/sched/cpufreq_schedutil.c           |    8 +-
 8 files changed, 1608 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]


#1483111 — [PATCH V2 1/2] cpufreq: Move gov_attr_* macros to cpufreq.h

FromViresh Kumar <viresh.kumar@linaro.org>
Date2016-09-14 11:00 +0200
Subject[PATCH V2 1/2] cpufreq: Move gov_attr_* macros to cpufreq.h
Message-ID<shecW-76W-13@gated-at.bofh.it>
In reply to#1483109
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 631ba33bbe9f..b65b1d795007 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -539,6 +539,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 69e06898997d..c67c751944a9 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -321,15 +321,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;
@@ -346,7 +346,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] | [standalone]


Back to top | Article view | linux.kernel


csiph-web