From: Yuyang Du <yuyang.du@intel.com>
To: mingo@redhat.com, peterz@infradead.org,
rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Cc: arjan.van.de.ven@intel.com, len.brown@intel.com,
alan.cox@intel.com, mark.gross@intel.com,
morten.rasmussen@arm.com, vincent.guittot@linaro.org,
rajeev.d.muralidhar@intel.com, vishwesh.m.rudramuni@intel.com,
nicole.chalhoub@intel.com, ajaya.durg@intel.com,
harinarayanan.seshadri@intel.com, yuyang.du@intel.com
Subject: [RFC PATCH 02/12 v1] Init for CPU ConCurrency
Date: Mon, 5 May 2014 08:02:42 +0800 [thread overview]
Message-ID: <1399248172-13871-3-git-send-email-yuyang.du@intel.com> (raw)
In-Reply-To: <1399248172-13871-1-git-send-email-yuyang.du@intel.com>
Signed-off-by: Yuyang Du <yuyang.du@intel.com>
---
kernel/sched/Makefile | 1 +
kernel/sched/concurrency.c | 22 ++++++++++++++++++++++
kernel/sched/core.c | 5 +++++
kernel/sched/sched.h | 21 +++++++++++++++++++++
4 files changed, 49 insertions(+)
create mode 100644 kernel/sched/concurrency.c
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index ab32b7b..e67f7e3 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o
obj-$(CONFIG_SCHEDSTATS) += stats.o
obj-$(CONFIG_SCHED_DEBUG) += debug.o
obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o
+obj-$(CONFIG_CPU_CONCURRENCY) += concurrency.o
diff --git a/kernel/sched/concurrency.c b/kernel/sched/concurrency.c
new file mode 100644
index 0000000..195bcf5
--- /dev/null
+++ b/kernel/sched/concurrency.c
@@ -0,0 +1,22 @@
+/*
+ * CPU ConCurrency (CC) is measures the CPU load by averaging
+ * the number of running tasks. Using CC, the scheduler can
+ * evaluate the load of CPUs to improve load balance for power
+ * efficiency without sacrificing performance.
+ *
+ */
+
+#ifdef CONFIG_CPU_CONCURRENCY
+
+#include "sched.h"
+
+void init_cpu_concurrency(struct rq *rq)
+{
+ rq->concurrency.sum = 0;
+ rq->concurrency.sum_now = 0;
+ rq->concurrency.contrib = 0;
+ rq->concurrency.nr_running = 0;
+ rq->concurrency.sum_timestamp = ULLONG_MAX;
+ rq->concurrency.contrib_timestamp = ULLONG_MAX;
+}
+#endif
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 268a45e..ff990f9 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6884,6 +6884,11 @@ void __init sched_init(void)
#endif
init_rq_hrtick(rq);
atomic_set(&rq->nr_iowait, 0);
+
+ /*
+ * cpu concurrency init
+ */
+ init_cpu_concurrency(rq);
}
set_load_weight(&init_task);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 456e492..0cf9bf0 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -508,6 +508,17 @@ extern struct root_domain def_root_domain;
#endif /* CONFIG_SMP */
+#ifdef CONFIG_CPU_CONCURRENCY
+struct cpu_concurrency_t {
+ u64 sum;
+ u64 sum_now;
+ u64 contrib;
+ u64 sum_timestamp;
+ u64 contrib_timestamp;
+ unsigned long nr_running;
+};
+#endif
+
/*
* This is the main, per-CPU runqueue data structure.
*
@@ -643,6 +654,10 @@ struct rq {
#ifdef CONFIG_SMP
struct llist_head wake_list;
#endif
+
+#ifdef CONFIG_CPU_CONCURRENCY
+ struct cpu_concurrency_t concurrency;
+#endif
};
static inline int cpu_of(struct rq *rq)
@@ -1203,6 +1218,12 @@ extern void init_sched_dl_class(void);
extern void resched_task(struct task_struct *p);
extern void resched_cpu(int cpu);
+#ifdef CONFIG_CPU_CONCURRENCY
+extern void init_cpu_concurrency(struct rq *rq);
+#else
+static inline void init_cpu_concurrency(struct rq *rq) {}
+#endif
+
extern struct rt_bandwidth def_rt_bandwidth;
extern void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime);
--
1.7.9.5
next prev parent reply other threads:[~2014-05-05 8:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 0:02 [RFC PATCH 00/12 v1] A new CPU load metric for power-efficient scheduler: " Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 01/12 v1] CONFIG for " Yuyang Du
2014-05-05 0:02 ` Yuyang Du [this message]
2014-05-05 0:02 ` [RFC PATCH 03/12 v1] CPU ConCurrency calculation Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 04/12 v1] CPU ConCurrency collecting in: Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 05/12 v1] CONFIG for Workload Consolidation Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 06/12 v1] Attach CPU topology Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 07/12 v1] CPU ConCurrency API for Workload Consolidation Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 08/12 v1] Intercept wakeup/fork/exec balance Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 09/12 v1] Intercept idle balance Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 10/12 v1] Intercept periodic nohz " Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 11/12 v1] Intercept periodic load balance Yuyang Du
2014-05-05 0:02 ` [RFC PATCH 12/12 v1] Intercept RT provocatively Yuyang Du
2014-05-05 9:37 ` [RFC PATCH 00/12 v1] A new CPU load metric for power-efficient scheduler: CPU ConCurrency Peter Zijlstra
2014-05-06 18:46 ` Yuyang Du
2014-05-15 14:50 ` Peter Zijlstra
2014-05-18 19:16 ` Yuyang Du
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=1399248172-13871-3-git-send-email-yuyang.du@intel.com \
--to=yuyang.du@intel.com \
--cc=ajaya.durg@intel.com \
--cc=alan.cox@intel.com \
--cc=arjan.van.de.ven@intel.com \
--cc=harinarayanan.seshadri@intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.gross@intel.com \
--cc=mingo@redhat.com \
--cc=morten.rasmussen@arm.com \
--cc=nicole.chalhoub@intel.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rajeev.d.muralidhar@intel.com \
--cc=vincent.guittot@linaro.org \
--cc=vishwesh.m.rudramuni@intel.com \
/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
all inboxes | Powered by JetHome®