Skip to content

Commit

Permalink
sched: Remove needless round trip nsecs <-> tick conversion of steal …
Browse files Browse the repository at this point in the history
…time

When update_rq_clock_task() accounts the pending steal time for a task,
it converts the steal delta from nsecs to tick then from tick to nsecs.

There is no apparent good reason for doing that though because both
the task clock and the prev steal delta are u64 and store values
in nsecs.

So lets remove the needless conversion.

Cc: Ingo Molnar <mingo@kernel.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
  • Loading branch information
Frederic Weisbecker committed Mar 13, 2014
1 parent dee08a7 commit 300a9d8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
6 changes: 0 additions & 6 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,19 +823,13 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
#endif
#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
if (static_key_false((&paravirt_steal_rq_enabled))) {
u64 st;

steal = paravirt_steal_clock(cpu_of(rq));
steal -= rq->prev_steal_time_rq;

if (unlikely(steal > delta))
steal = delta;

st = steal_ticks(steal);
steal = st * TICK_NSEC;

rq->prev_steal_time_rq += steal;

delta -= steal;
}
#endif
Expand Down
10 changes: 0 additions & 10 deletions kernel/sched/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1214,16 +1214,6 @@ extern void update_idle_cpu_load(struct rq *this_rq);

extern void init_task_runnable_average(struct task_struct *p);

#ifdef CONFIG_PARAVIRT
static inline u64 steal_ticks(u64 steal)
{
if (unlikely(steal > NSEC_PER_SEC))
return div_u64(steal, TICK_NSEC);

return __iter_div_u64_rem(steal, TICK_NSEC, &steal);
}
#endif

static inline void inc_nr_running(struct rq *rq)
{
rq->nr_running++;
Expand Down

0 comments on commit 300a9d8

Please sign in to comment.