aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index d99aeabeb72f..bbc40c3a0657 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1693,6 +1693,12 @@ static void set_load_weight(struct task_struct *p)
1693 p->se.load.inv_weight = prio_to_wmult[p->static_prio - MAX_RT_PRIO]; 1693 p->se.load.inv_weight = prio_to_wmult[p->static_prio - MAX_RT_PRIO];
1694} 1694}
1695 1695
1696static void update_avg(u64 *avg, u64 sample)
1697{
1698 s64 diff = sample - *avg;
1699 *avg += diff >> 3;
1700}
1701
1696static void enqueue_task(struct rq *rq, struct task_struct *p, int wakeup) 1702static void enqueue_task(struct rq *rq, struct task_struct *p, int wakeup)
1697{ 1703{
1698 sched_info_queued(p); 1704 sched_info_queued(p);
@@ -1702,6 +1708,12 @@ static void enqueue_task(struct rq *rq, struct task_struct *p, int wakeup)
1702 1708
1703static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep) 1709static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep)
1704{ 1710{
1711 if (sleep && p->se.last_wakeup) {
1712 update_avg(&p->se.avg_overlap,
1713 p->se.sum_exec_runtime - p->se.last_wakeup);
1714 p->se.last_wakeup = 0;
1715 }
1716
1705 p->sched_class->dequeue_task(rq, p, sleep); 1717 p->sched_class->dequeue_task(rq, p, sleep);
1706 p->se.on_rq = 0; 1718 p->se.on_rq = 0;
1707} 1719}
@@ -2313,6 +2325,8 @@ out_running:
2313 p->sched_class->task_wake_up(rq, p); 2325 p->sched_class->task_wake_up(rq, p);
2314#endif 2326#endif
2315out: 2327out:
2328 current->se.last_wakeup = current->se.sum_exec_runtime;
2329
2316 task_rq_unlock(rq, &flags); 2330 task_rq_unlock(rq, &flags);
2317 2331
2318 return success; 2332 return success;