summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoonwoo Park <joonwoop@codeaurora.org>2015-08-31 17:21:35 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:02:43 -0700
commit07eb3f803b419bdebad45d846113dc069307be90 (patch)
tree845a39607dde5f403295b161cbd321ee4e4f3122 /include
parentfd38bb103d3e0be4796dd9fa19c2d0c90c06cf6a (diff)
sched: select task's prev_cpu as the best CPU when it was chosen recently
Select given task's prev_cpu when the task slept for short period to reduce latency of task placement and migrations. A new tunable /proc/sys/kernel/sched_select_prev_cpu_us introduced to determine whether tasks are eligible to go through fast path. CRs-fixed: 947467 Change-Id: Ia507665b91f4e9f0e6ee1448d8df8994ead9739a [joonwoop@codeaurora.org: fixed conflict in include/linux/sched.h, include/linux/sched/sysctl.h, kernel/sched/core.c and kernel/sysctl.c] Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/sched/sysctl.h1
-rw-r--r--include/trace/events/sched.h11
3 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d5275982df22..2125f214f287 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1458,6 +1458,7 @@ struct task_struct {
*/
u32 init_load_pct;
u64 last_wake_ts;
+ u64 last_switch_out_ts;
#endif
#ifdef CONFIG_CGROUP_SCHED
struct task_group *sched_task_group;
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 0663cf3c7410..bfea9efef2e9 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -70,6 +70,7 @@ extern unsigned int sysctl_early_detection_duration;
extern unsigned int sysctl_sched_lowspill_freq;
extern unsigned int sysctl_sched_pack_freq;
extern unsigned int sysctl_sched_boost;
+extern unsigned int sysctl_sched_select_prev_cpu_us;
#if defined(CONFIG_SCHED_FREQ_INPUT)
extern unsigned int sysctl_sched_new_task_windows;
#endif
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 979758d8702e..fc9c0d768c68 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -112,9 +112,9 @@ TRACE_EVENT(sched_enq_deq_task,
TRACE_EVENT(sched_task_load,
TP_PROTO(struct task_struct *p, bool boost, int reason,
- bool sync, bool need_idle, int best_cpu),
+ bool sync, bool need_idle, bool fast_path, int best_cpu),
- TP_ARGS(p, boost, reason, sync, need_idle, best_cpu),
+ TP_ARGS(p, boost, reason, sync, need_idle, fast_path, best_cpu),
TP_STRUCT__entry(
__array( char, comm, TASK_COMM_LEN )
@@ -124,6 +124,7 @@ TRACE_EVENT(sched_task_load,
__field( int, reason )
__field( bool, sync )
__field( bool, need_idle )
+ __field( bool, fast_path )
__field( int, best_cpu )
__field( u64, latency )
),
@@ -136,16 +137,18 @@ TRACE_EVENT(sched_task_load,
__entry->reason = reason;
__entry->sync = sync;
__entry->need_idle = need_idle;
+ __entry->fast_path = fast_path;
__entry->best_cpu = best_cpu;
__entry->latency = p->state == TASK_WAKING ?
sched_ktime_clock() -
p->ravg.mark_start : 0;
),
- TP_printk("%d (%s): demand=%u boost=%d reason=%d sync=%d need_idle=%d best_cpu=%d latency=%llu",
+ TP_printk("%d (%s): demand=%u boost=%d reason=%d sync=%d need_idle=%d fast_path=%d best_cpu=%d latency=%llu",
__entry->pid, __entry->comm, __entry->demand,
__entry->boost, __entry->reason, __entry->sync,
- __entry->need_idle, __entry->best_cpu, __entry->latency)
+ __entry->need_idle, __entry->fast_path,
+ __entry->best_cpu, __entry->latency)
);
DECLARE_EVENT_CLASS(sched_cpu_load,