sched: Remove broken check for skip clock update
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.
--- kernel/sched/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/core.c +1 -1
@@ -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
Steven Rostedt
reviewerQuoted 7 lines · Frederic Weisbecker
rq->skip_clock_updateshouldn't be negative. Thus the check input_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 inschedule(). But we want to ignore that update if a ttwu did it for us, in which caserq->skip_clock_updateis 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
Signed-off-by Frederic Weisbecker <[email protected]>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@@ -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); }
2013/1/8 Steven Rostedt <[email protected]>:
Quoted 17 lines · Frederic Weisbecker
Quoted 7 lines
rq->skip_clock_updateshouldn't be negative. Thus the check input_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 inschedule(). But we want to ignore that update if a ttwu did it for us, in which caserq->skip_clock_updateis 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.