提交 ff7de620 编写于 作者: R Rafael J. Wysocki

nohz: Avoid duplication of code related to got_idle_tick

Move the code setting ts->got_idle_tick into tick_sched_do_timer() to
avoid code duplication.

No intentional changes in functionality.
Suggested-by: NFrederic Weisbecker <frederic@kernel.org>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: NFrederic Weisbecker <frederic@kernel.org>
上级 2bc629a6
...@@ -113,8 +113,7 @@ static ktime_t tick_init_jiffy_update(void) ...@@ -113,8 +113,7 @@ static ktime_t tick_init_jiffy_update(void)
return period; return period;
} }
static void tick_sched_do_timer(struct tick_sched *ts, ktime_t now)
static void tick_sched_do_timer(ktime_t now)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
...@@ -134,6 +133,9 @@ static void tick_sched_do_timer(ktime_t now) ...@@ -134,6 +133,9 @@ static void tick_sched_do_timer(ktime_t now)
/* Check, if the jiffies need an update */ /* Check, if the jiffies need an update */
if (tick_do_timer_cpu == cpu) if (tick_do_timer_cpu == cpu)
tick_do_update_jiffies64(now); tick_do_update_jiffies64(now);
if (ts->inidle)
ts->got_idle_tick = 1;
} }
static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs) static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs)
...@@ -1162,12 +1164,9 @@ static void tick_nohz_handler(struct clock_event_device *dev) ...@@ -1162,12 +1164,9 @@ static void tick_nohz_handler(struct clock_event_device *dev)
struct pt_regs *regs = get_irq_regs(); struct pt_regs *regs = get_irq_regs();
ktime_t now = ktime_get(); ktime_t now = ktime_get();
if (ts->inidle)
ts->got_idle_tick = 1;
dev->next_event = KTIME_MAX; dev->next_event = KTIME_MAX;
tick_sched_do_timer(now); tick_sched_do_timer(ts, now);
tick_sched_handle(ts, regs); tick_sched_handle(ts, regs);
/* No need to reprogram if we are running tickless */ /* No need to reprogram if we are running tickless */
...@@ -1262,10 +1261,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer) ...@@ -1262,10 +1261,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
struct pt_regs *regs = get_irq_regs(); struct pt_regs *regs = get_irq_regs();
ktime_t now = ktime_get(); ktime_t now = ktime_get();
if (ts->inidle) tick_sched_do_timer(ts, now);
ts->got_idle_tick = 1;
tick_sched_do_timer(now);
/* /*
* Do not call, when we are not in irq context and have * Do not call, when we are not in irq context and have
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册