summaryrefslogtreecommitdiff
path: root/kernel/sched/sched.h
diff options
context:
space:
mode:
authorSai Gurrappadi <sgurrappadi@nvidia.com>2014-01-21 16:41:37 -0800
committerDiwakar Tundlam <dtundlam@nvidia.com>2014-03-03 19:38:54 -0800
commit3bfdbefc2cf0ecf2933250813c356b3d147e59e0 (patch)
treede830b9368a6ac8b3788fbb47054b7633771c8a0 /kernel/sched/sched.h
parent33db1f7eb8e2d9eaad2dce65152cd5b2a4a27fae (diff)
sched: Force sleep on consecutive sched_yields
If a task sched_yields to itself continuously, force the task to sleep in sched_yield. This will lower the CPU load of this task thereby lowering the cpu frequency and improving power. Added a stat variable to track how many times we sleep due these consecutive sched_yields. Also added sysctl knobs to control the number of consecutive sched_yields before which the sleep kicks in and the duration fo the sleep in us. Bug 1424617 Change-Id: Ie92412b8b900365816e17237fcbd0aac6e9c94ce Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com> Reviewed-on: http://git-master/r/358455 Reviewed-by: Wen Yi <wyi@nvidia.com> Reviewed-by: Peter Zu <pzu@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Diffstat (limited to 'kernel/sched/sched.h')
-rw-r--r--kernel/sched/sched.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 35bd8b7f3a87..0fc275c70d7d 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -511,6 +511,7 @@ struct rq {
/* sys_sched_yield() stats */
unsigned int yld_count;
+ unsigned int yield_sleep_count;
/* schedule() stats */
unsigned int sched_count;
@@ -1143,6 +1144,8 @@ extern void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags);
extern const_debug unsigned int sysctl_sched_time_avg;
extern const_debug unsigned int sysctl_sched_nr_migrate;
extern const_debug unsigned int sysctl_sched_migration_cost;
+extern const_debug unsigned int sysctl_sched_yield_sleep_duration;
+extern const_debug int sysctl_sched_yield_sleep_threshold;
static inline u64 sched_avg_period(void)
{