summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSumit Singh <sumsingh@nvidia.com>2014-02-18 19:35:25 +0530
committerBharat Nihalani <bnihalani@nvidia.com>2014-03-24 01:17:33 -0700
commit6e4ee00333a93fdf949c283cce0f0e948cbae08f (patch)
treed423b47e9bcfe9f0608ad12f36b898ffc8a11e2f /kernel
parent16fb68954dde0d7fb0abf2f474a33c5d11342b67 (diff)
sched: Trying to reduce power usage
Using macros cpu_relaxed_read, cpu_relaxed_read_long and cpu_read_relax in core.c to improve power efficiency. Bug 1440421 Change-Id: Ic49b88fa6fb0cb847fed49886b2865bed72203db Signed-off-by: Sumit Singh <sumsingh@nvidia.com> Reviewed-on: http://git-master/r/368841 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 960acc06a818..d10482a0c683 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5,6 +5,8 @@
*
* Copyright (C) 1991-2002 Linus Torvalds
*
+ * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
+ *
* 1996-12-23 Modified by Dave Grothe to fix bugs in semaphores and
* make semaphores SMP safe
* 1998-11-19 Implemented schedule_timeout() and related stuff
@@ -1091,9 +1093,10 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
* is actually now running somewhere else!
*/
while (task_running(rq, p)) {
- if (match_state && unlikely(p->state != match_state))
+ if (match_state && unlikely(cpu_relaxed_read_long
+ (&(p->state)) != match_state))
return 0;
- cpu_relax();
+ cpu_read_relax();
}
/*
@@ -1521,8 +1524,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
* If the owning (remote) cpu is still in the middle of schedule() with
* this task as prev, wait until its done referencing the task.
*/
- while (p->on_cpu)
- cpu_relax();
+ while (cpu_relaxed_read(&(p->on_cpu)))
+ cpu_read_relax();
/*
* Pairs with the smp_wmb() in finish_lock_switch().
*/