Commit 03e89e45 authored by Mike Galbraith's avatar Mike Galbraith Committed by Ingo Molnar

sched: fix wakeup preemption clock

Impact: sharpen the wakeup-granularity to always be against current scheduler time

It was possible to do the preemption check against an old time stamp.
Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent d65bd5ec
...@@ -2266,6 +2266,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync) ...@@ -2266,6 +2266,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
smp_wmb(); smp_wmb();
rq = task_rq_lock(p, &flags); rq = task_rq_lock(p, &flags);
update_rq_clock(rq);
old_state = p->state; old_state = p->state;
if (!(old_state & state)) if (!(old_state & state))
goto out; goto out;
...@@ -2323,7 +2324,6 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync) ...@@ -2323,7 +2324,6 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
schedstat_inc(p, se.nr_wakeups_local); schedstat_inc(p, se.nr_wakeups_local);
else else
schedstat_inc(p, se.nr_wakeups_remote); schedstat_inc(p, se.nr_wakeups_remote);
update_rq_clock(rq);
activate_task(rq, p, 1); activate_task(rq, p, 1);
success = 1; success = 1;
......
...@@ -1345,12 +1345,11 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync) ...@@ -1345,12 +1345,11 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
{ {
struct task_struct *curr = rq->curr; struct task_struct *curr = rq->curr;
struct sched_entity *se = &curr->se, *pse = &p->se; struct sched_entity *se = &curr->se, *pse = &p->se;
struct cfs_rq *cfs_rq = task_cfs_rq(curr);
if (unlikely(rt_prio(p->prio))) { update_curr(cfs_rq);
struct cfs_rq *cfs_rq = task_cfs_rq(curr);
update_rq_clock(rq); if (unlikely(rt_prio(p->prio))) {
update_curr(cfs_rq);
resched_task(curr); resched_task(curr);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment