Skip to contentSkip to conversation

sched: Remove broken check for skip clock update

PATCH In review Frederic Weisbecker 2 participants 3 messages Jan 8, 2013 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Remove broken check for skip clock update

rq->skip_clock_update shouldn't be negative. Thus the check in put_prev_task() is useless.

It was probably intended to do the following check:

	if (prev->on_rq && !rq->skip_clock_update)

We only want to update the clock if the current task is not voluntarily sleeping: otherwise deactivate_task() already did the rq clock update in schedule(). But we want to ignore that update if a ttwu did it for us, in which case rq->skip_clock_update is 1.

But update_rq_clock() already takes care of that so we can just remove the broken condition.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steven Rostedt <[email protected]>
---
 kernel/sched/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/core.c +1 -1
index 15ba35e..8dfc461 100644
@@ -2886,7 +2886,7 @@ static inline void schedule_debug(struct task_struct *prev)
 
 static void put_prev_task(struct rq *rq, struct task_struct *prev)
 {
-	if (prev->on_rq || rq->skip_clock_update < 0)
+	if (prev->on_rq)
 		update_rq_clock(rq);
 	prev->sched_class->put_prev_task(rq, prev);
 }
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 7 lines · Frederic Weisbecker

rq->skip_clock_update shouldn't be negative. Thus the check in put_prev_task() is useless.

It was probably intended to do the following check:

	if (prev->on_rq && !rq->skip_clock_update)
Quoted 8 lines

We only want to update the clock if the current task is not voluntarily sleeping: otherwise deactivate_task() already did the rq clock update in schedule(). But we want to ignore that update if a ttwu did it for us, in which case rq->skip_clock_update is 1.

But update_rq_clock() already takes care of that so we can just remove the broken condition.

kernel/sched/rt.c:

                                /*
                                 * Force a clock update if the CPU was idle,
                                 * lest wakeup -> unthrottle time accumulate.
                                 */
                                if (rt_rq->rt_nr_running && rq->curr == rq->idle)
                                        rq->skip_clock_update = -1;

-- Steve

Quoted 22 lines
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steven Rostedt <[email protected]>
---
 kernel/sched/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/core.c +1 -1
index 15ba35e..8dfc461 100644
@@ -2886,7 +2886,7 @@ static inline void schedule_debug(struct task_struct *prev)
 
 static void put_prev_task(struct rq *rq, struct task_struct *prev)
 {
-	if (prev->on_rq || rq->skip_clock_update < 0)
+	if (prev->on_rq)
 		update_rq_clock(rq);
 	prev->sched_class->put_prev_task(rq, prev);
 }
#2 lore raw

2013/1/8 Steven Rostedt <[email protected]>:

Quoted 17 lines · Frederic Weisbecker
Quoted 7 lines

rq->skip_clock_update shouldn't be negative. Thus the check in put_prev_task() is useless.

It was probably intended to do the following check:

      if (prev->on_rq && !rq->skip_clock_update)
Quoted 8 lines

We only want to update the clock if the current task is not voluntarily sleeping: otherwise deactivate_task() already did the rq clock update in schedule(). But we want to ignore that update if a ttwu did it for us, in which case rq->skip_clock_update is 1.

But update_rq_clock() already takes care of that so we can just remove the broken condition.

Quoted 8 lines

kernel/sched/rt.c:

                                /*
                                 * Force a clock update if the CPU was idle,
                                 * lest wakeup -> unthrottle time accumulate.
                                 */
                                if (rt_rq->rt_nr_running && rq->curr == rq->idle)
                                        rq->skip_clock_update = -1;

Grr, I knew I was missing something!

Ok let's drop that patch then.