Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 135705
b: refs/heads/master
c: df1c99d
h: refs/heads/master
i:
  135703: e78b4c5
v: v3
  • Loading branch information
Mike Galbraith authored and Ingo Molnar committed Mar 11, 2009
1 parent aa41a2a commit ce0b679
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 57310a98a354e84279d7c8af2f48805a62372e53
refs/heads/master: df1c99d416500da8d26a4d78777467c53ee7689e
24 changes: 23 additions & 1 deletion trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -4620,6 +4620,28 @@ static inline void schedule_debug(struct task_struct *prev)
#endif
}

static void put_prev_task(struct rq *rq, struct task_struct *prev)
{
if (prev->state == TASK_RUNNING) {
u64 runtime = prev->se.sum_exec_runtime;

runtime -= prev->se.prev_sum_exec_runtime;
runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);

/*
* In order to avoid avg_overlap growing stale when we are
* indeed overlapping and hence not getting put to sleep, grow
* the avg_overlap on preemption.
*
* We use the average preemption runtime because that
* correlates to the amount of cache footprint a task can
* build up.
*/
update_avg(&prev->se.avg_overlap, runtime);
}
prev->sched_class->put_prev_task(rq, prev);
}

/*
* Pick up the highest-prio task:
*/
Expand Down Expand Up @@ -4698,7 +4720,7 @@ asmlinkage void __sched schedule(void)
if (unlikely(!rq->nr_running))
idle_balance(cpu, rq);

prev->sched_class->put_prev_task(rq, prev);
put_prev_task(rq, prev);
next = pick_next_task(rq);

if (likely(prev != next)) {
Expand Down

0 comments on commit ce0b679

Please sign in to comment.