aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/tick.h6
-rw-r--r--kernel/sched/core.c2
-rw-r--r--kernel/softirq.c2
-rw-r--r--kernel/time/tick-sched.c27
5 files changed, 25 insertions, 18 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index d235e88cfd7c..1f44466c1e9d 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -294,6 +294,12 @@ extern unsigned long preset_lpj;
294 */ 294 */
295extern unsigned int jiffies_to_msecs(const unsigned long j); 295extern unsigned int jiffies_to_msecs(const unsigned long j);
296extern unsigned int jiffies_to_usecs(const unsigned long j); 296extern unsigned int jiffies_to_usecs(const unsigned long j);
297
298static inline u64 jiffies_to_nsecs(const unsigned long j)
299{
300 return (u64)jiffies_to_usecs(j) * NSEC_PER_USEC;
301}
302
297extern unsigned long msecs_to_jiffies(const unsigned int m); 303extern unsigned long msecs_to_jiffies(const unsigned int m);
298extern unsigned long usecs_to_jiffies(const unsigned int u); 304extern unsigned long usecs_to_jiffies(const unsigned int u);
299extern unsigned long timespec_to_jiffies(const struct timespec *value); 305extern unsigned long timespec_to_jiffies(const struct timespec *value);
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 0175d8663b6c..b84773cb9f4c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -104,7 +104,7 @@ extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
104extern void tick_clock_notify(void); 104extern void tick_clock_notify(void);
105extern int tick_check_oneshot_change(int allow_nohz); 105extern int tick_check_oneshot_change(int allow_nohz);
106extern struct tick_sched *tick_get_tick_sched(int cpu); 106extern struct tick_sched *tick_get_tick_sched(int cpu);
107extern void tick_check_idle(void); 107extern void tick_irq_enter(void);
108extern int tick_oneshot_mode_active(void); 108extern int tick_oneshot_mode_active(void);
109# ifndef arch_needs_cpu 109# ifndef arch_needs_cpu
110# define arch_needs_cpu(cpu) (0) 110# define arch_needs_cpu(cpu) (0)
@@ -112,7 +112,7 @@ extern int tick_oneshot_mode_active(void);
112# else 112# else
113static inline void tick_clock_notify(void) { } 113static inline void tick_clock_notify(void) { }
114static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 114static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
115static inline void tick_check_idle(void) { } 115static inline void tick_irq_enter(void) { }
116static inline int tick_oneshot_mode_active(void) { return 0; } 116static inline int tick_oneshot_mode_active(void) { return 0; }
117# endif 117# endif
118 118
@@ -121,7 +121,7 @@ static inline void tick_init(void) { }
121static inline void tick_cancel_sched_timer(int cpu) { } 121static inline void tick_cancel_sched_timer(int cpu) { }
122static inline void tick_clock_notify(void) { } 122static inline void tick_clock_notify(void) { }
123static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 123static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
124static inline void tick_check_idle(void) { } 124static inline void tick_irq_enter(void) { }
125static inline int tick_oneshot_mode_active(void) { return 0; } 125static inline int tick_oneshot_mode_active(void) { return 0; }
126#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 126#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
127 127
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 36c951b7eef8..75badda95d61 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2453,7 +2453,7 @@ u64 scheduler_tick_max_deferment(void)
2453 if (time_before_eq(next, now)) 2453 if (time_before_eq(next, now))
2454 return 0; 2454 return 0;
2455 2455
2456 return jiffies_to_usecs(next - now) * NSEC_PER_USEC; 2456 return jiffies_to_nsecs(next - now);
2457} 2457}
2458#endif 2458#endif
2459 2459
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 8a1e6e104892..991e38d9f71e 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -326,7 +326,7 @@ void irq_enter(void)
326 * here, as softirq will be serviced on return from interrupt. 326 * here, as softirq will be serviced on return from interrupt.
327 */ 327 */
328 local_bh_disable(); 328 local_bh_disable();
329 tick_check_idle(); 329 tick_irq_enter();
330 _local_bh_enable(); 330 _local_bh_enable();
331 } 331 }
332 332
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 08cb0c3b8ccb..9f8af69c67ec 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -533,12 +533,13 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
533 struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev; 533 struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev;
534 u64 time_delta; 534 u64 time_delta;
535 535
536 time_delta = timekeeping_max_deferment();
537
536 /* Read jiffies and the time when jiffies were updated last */ 538 /* Read jiffies and the time when jiffies were updated last */
537 do { 539 do {
538 seq = read_seqbegin(&jiffies_lock); 540 seq = read_seqbegin(&jiffies_lock);
539 last_update = last_jiffies_update; 541 last_update = last_jiffies_update;
540 last_jiffies = jiffies; 542 last_jiffies = jiffies;
541 time_delta = timekeeping_max_deferment();
542 } while (read_seqretry(&jiffies_lock, seq)); 543 } while (read_seqretry(&jiffies_lock, seq));
543 544
544 if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) || 545 if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) ||
@@ -678,18 +679,18 @@ out:
678static void tick_nohz_full_stop_tick(struct tick_sched *ts) 679static void tick_nohz_full_stop_tick(struct tick_sched *ts)
679{ 680{
680#ifdef CONFIG_NO_HZ_FULL 681#ifdef CONFIG_NO_HZ_FULL
681 int cpu = smp_processor_id(); 682 int cpu = smp_processor_id();
682 683
683 if (!tick_nohz_full_cpu(cpu) || is_idle_task(current)) 684 if (!tick_nohz_full_cpu(cpu) || is_idle_task(current))
684 return; 685 return;
685 686
686 if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE) 687 if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE)
687 return; 688 return;
688 689
689 if (!can_stop_full_tick()) 690 if (!can_stop_full_tick())
690 return; 691 return;
691 692
692 tick_nohz_stop_sched_tick(ts, ktime_get(), cpu); 693 tick_nohz_stop_sched_tick(ts, ktime_get(), cpu);
693#endif 694#endif
694} 695}
695 696
@@ -1023,7 +1024,7 @@ static void tick_nohz_kick_tick(struct tick_sched *ts, ktime_t now)
1023#endif 1024#endif
1024} 1025}
1025 1026
1026static inline void tick_check_nohz_this_cpu(void) 1027static inline void tick_nohz_irq_enter(void)
1027{ 1028{
1028 struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); 1029 struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
1029 ktime_t now; 1030 ktime_t now;
@@ -1042,17 +1043,17 @@ static inline void tick_check_nohz_this_cpu(void)
1042#else 1043#else
1043 1044
1044static inline void tick_nohz_switch_to_nohz(void) { } 1045static inline void tick_nohz_switch_to_nohz(void) { }
1045static inline void tick_check_nohz_this_cpu(void) { } 1046static inline void tick_nohz_irq_enter(void) { }
1046 1047
1047#endif /* CONFIG_NO_HZ_COMMON */ 1048#endif /* CONFIG_NO_HZ_COMMON */
1048 1049
1049/* 1050/*
1050 * Called from irq_enter to notify about the possible interruption of idle() 1051 * Called from irq_enter to notify about the possible interruption of idle()
1051 */ 1052 */
1052void tick_check_idle(void) 1053void tick_irq_enter(void)
1053{ 1054{
1054 tick_check_oneshot_broadcast_this_cpu(); 1055 tick_check_oneshot_broadcast_this_cpu();
1055 tick_check_nohz_this_cpu(); 1056 tick_nohz_irq_enter();
1056} 1057}
1057 1058
1058/* 1059/*