public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vikram Mulukutla <markivx@codeaurora.org>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Srivatsa Vaddagiri <vatsa@codeaurora.org>,
	Steve Muckle <steve.muckle@linaro.org>,
	Olav Haugan <ohaugan@codeaurora.org>,
	Syed Rameez Mustafa <rameezmustafa@codeaurora.org>,
	Joonwoo Park <joonwoop@codeaurora.org>,
	Pavankumar Kondeti <pkondeti@codeaurora.org>,
	Saravana Kannan <skannan@codeaurora.org>,
	Bryan Huntsman <bryanh@codeaurora.org>,
	Juri Lelli <juri.lelli@arm.com>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Chris Redpath <chris.redpath@arm.com>,
	Robin Randhawa <robin.randhawa@arm.com>,
	Patrick Bellasi <patrick.bellasi@arm.com>,
	Todd Kjos <tkjos@google.com>,
	Srinath Sridharan <srinathsr@google.com>,
	Andres Oportus <andresoportus@google.com>,
	Leo Yan <leo.yan@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Vikram Mulukutla <markivx@codeauorora.org>,
	Vikram Mulukutla <markivx@codeaurora.org>
Subject: [RFC PATCH 1/3] sched: Introduce structures necessary for WALT
Date: Fri, 28 Oct 2016 00:10:40 -0700	[thread overview]
Message-ID: <1477638642-17428-2-git-send-email-markivx@codeaurora.org> (raw)
In-Reply-To: <1477638642-17428-1-git-send-email-markivx@codeaurora.org>

From: Srivatsa Vaddagiri <vatsa@codeaurora.org>

Add the per-task and per-runqueue data structures that
will later be used by Window Assisted Load Tracking (WALT)
to estimate task demand and CPU utilization.

Move cap_scale into sched.h as that will be needed by WALT
as well to implement frequency and capacity invariance.

Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
---
 include/linux/sched.h | 39 +++++++++++++++++++++++++++++++++++++++
 kernel/sched/fair.c   |  2 --
 kernel/sched/sched.h  |  8 ++++++++
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 62c68e5..64f8bec 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -315,6 +315,21 @@ extern char ___assert_task_state[1 - 2*!!(
 /* Task command name length */
 #define TASK_COMM_LEN 16
 
+/*
+ * These events may be replaced with a combination of existing scheduler flags
+ * provided that that doesn't make the implementation too fragile.
+ */
+enum task_event {
+	PUT_PREV_TASK   = 0,
+	PICK_NEXT_TASK  = 1,
+	TASK_WAKE       = 2,
+	TASK_MIGRATE    = 3,
+	TASK_UPDATE     = 4,
+	IRQ_UPDATE      = 5,
+};
+
+extern char *task_event_names[];
+
 #include <linux/spinlock.h>
 
 /*
@@ -1320,6 +1335,25 @@ struct sched_statistics {
 };
 #endif
 
+#ifdef CONFIG_SCHED_WALT
+
+/* ravg represents capacity scaled cpu-usage of tasks */
+struct ravg {
+	/*
+	 * 'mark_start' marks the most recent event for a task
+	 *
+	 * 'curr_window' represents task's cpu usage in its most recent
+	 * window
+	 *
+	 * 'prev_window' represents task's cpu usage in the window prior
+	 * to the one represented by 'curr_window'
+	*/
+	u64 mark_start;
+	u32 curr_window, prev_window;
+};
+#endif
+
+
 struct sched_entity {
 	struct load_weight	load;		/* for load-balancing */
 	struct rb_node		run_node;
@@ -1480,6 +1514,11 @@ struct task_struct {
 	const struct sched_class *sched_class;
 	struct sched_entity se;
 	struct sched_rt_entity rt;
+
+#ifdef CONFIG_SCHED_WALT
+	struct ravg ravg;
+#endif
+
 #ifdef CONFIG_CGROUP_SCHED
 	struct task_group *sched_task_group;
 #endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ce8b244..39c826d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2674,8 +2674,6 @@ static u32 __compute_runnable_contrib(u64 n)
 	return contrib + runnable_avg_yN_sum[n];
 }
 
-#define cap_scale(v, s) ((v)*(s) >> SCHED_CAPACITY_SHIFT)
-
 /*
  * We can represent the historical contribution to runnable average as the
  * coefficients of a geometric series.  To do this we sub-divide our runnable
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index c64fc51..9bf6925 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -65,6 +65,8 @@ static inline void cpu_load_update_active(struct rq *this_rq) { }
 # define scale_load_down(w)	(w)
 #endif
 
+#define cap_scale(v, s) ((v)*(s) >> SCHED_CAPACITY_SHIFT)
+
 /*
  * Task weight (visible to users) and its load (invisible to users) have
  * independent resolution, but they should be well calibrated. We use
@@ -664,6 +666,12 @@ struct rq {
 	u64 max_idle_balance_cost;
 #endif
 
+#ifdef CONFIG_SCHED_WALT
+	u64 window_start;
+	u64 curr_runnable_sum;
+	u64 prev_runnable_sum;
+#endif /* CONFIG_SCHED_WALT */
+
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
 	u64 prev_irq_time;
 #endif
-- 
TheMan

  reply	other threads:[~2016-10-28  7:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28  7:10 [RFC PATCH 0/3] sched: Introduce Window Assisted Load Tracking Vikram Mulukutla
2016-10-28  7:10 ` Vikram Mulukutla [this message]
2016-10-28  7:10 ` [RFC PATCH 2/3] sched: Introduce Window-Assisted CPU utilization Tracking Vikram Mulukutla
2016-10-28  7:38   ` Peter Zijlstra
2016-10-28  7:43   ` Peter Zijlstra
2016-10-28  7:58     ` Vikram Mulukutla
2016-10-28  7:46   ` Peter Zijlstra
2016-10-28  8:03     ` Vikram Mulukutla
2016-10-28  7:52   ` Peter Zijlstra
2016-10-28  7:10 ` [RFC PATCH 3/3] sched: Introduce WALT hooks into core and scheduling classes Vikram Mulukutla
2016-10-28  7:57   ` Peter Zijlstra
2016-10-28  7:29 ` [RFC PATCH 0/3] sched: Introduce Window Assisted Load Tracking Peter Zijlstra
2016-10-28  7:55   ` Vikram Mulukutla
2016-10-28  9:23     ` Peter Zijlstra
2016-10-28  7:49 ` Peter Zijlstra
2016-10-28  7:57   ` Vikram Mulukutla
2016-10-28  8:49     ` Peter Zijlstra
2016-10-31 15:07       ` Vikram Mulukutla

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=1477638642-17428-2-git-send-email-markivx@codeaurora.org \
    --to=markivx@codeaurora.org \
    --cc=andresoportus@google.com \
    --cc=bryanh@codeaurora.org \
    --cc=chris.redpath@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joonwoop@codeaurora.org \
    --cc=juri.lelli@arm.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markivx@codeauorora.org \
    --cc=mingo@kernel.org \
    --cc=morten.rasmussen@arm.com \
    --cc=ohaugan@codeaurora.org \
    --cc=patrick.bellasi@arm.com \
    --cc=peterz@infradead.org \
    --cc=pkondeti@codeaurora.org \
    --cc=rameezmustafa@codeaurora.org \
    --cc=robin.randhawa@arm.com \
    --cc=skannan@codeaurora.org \
    --cc=srinathsr@google.com \
    --cc=steve.muckle@linaro.org \
    --cc=tkjos@google.com \
    --cc=vatsa@codeaurora.org \
    --cc=vincent.guittot@linaro.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