summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Muckle <smuckle@codeaurora.org>2014-07-30 14:59:31 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:00:20 -0700
commitecae24dd9267323fc0dcc2ed8e8554cef7d0cc7c (patch)
tree1d2f8a55a54607b6dc8955f9112d7f6ed1291192
parent8eede4a8d50a1d4e7203a4bbaa3209ddf346c985 (diff)
sched: fix misalignment between requested and actual windows
When set_window_start() is first executed sched_clock() has not yet stabilized. Refresh the sched_init_jiffy and sched_clock_at_init_jiffy values until it is known that sched_clock has stabilized - this will be the case by the time a client calls the sched_set_window() API. Change-Id: Icd057707ff44c3b240e5e7e96891b23c95733daa Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
-rw-r--r--kernel/sched/core.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ec1b7a036cc2..e6fe5e28aa96 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1655,18 +1655,23 @@ static inline void mark_task_starting(struct task_struct *p)
p->ravg.flags |= PREV_WINDOW_CONTRIB;
}
+static int update_alignment;
+
static inline void set_window_start(struct rq *rq)
{
int cpu = cpu_of(rq);
struct rq *sync_rq = cpu_rq(sync_cpu);
+ if (cpu == sync_cpu && !update_alignment) {
+ sched_init_jiffy = get_jiffies_64();
+ sched_clock_at_init_jiffy = sched_clock();
+ }
+
if (rq->window_start || !sched_enable_hmp)
return;
if (cpu == sync_cpu) {
- rq->window_start = sched_clock();
- sched_init_jiffy = get_jiffies_64();
- sched_clock_at_init_jiffy = rq->window_start;
+ rq->window_start = sched_clock_at_init_jiffy;
} else {
raw_spin_unlock(&rq->lock);
double_rq_lock(rq, sync_rq);
@@ -1778,6 +1783,8 @@ int sched_set_window(u64 window_start, unsigned int window_size)
(window_size * TICK_NSEC < MIN_SCHED_RAVG_WINDOW))
return -EINVAL;
+ update_alignment = 1;
+
local_irq_save(flags);
now = get_jiffies_64();