diff options
| -rw-r--r-- | include/linux/jiffies.h | 6 | ||||
| -rw-r--r-- | include/linux/tick.h | 6 | ||||
| -rw-r--r-- | kernel/sched/core.c | 2 | ||||
| -rw-r--r-- | kernel/softirq.c | 2 | ||||
| -rw-r--r-- | kernel/time/tick-sched.c | 27 |
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 | */ |
| 295 | extern unsigned int jiffies_to_msecs(const unsigned long j); | 295 | extern unsigned int jiffies_to_msecs(const unsigned long j); |
| 296 | extern unsigned int jiffies_to_usecs(const unsigned long j); | 296 | extern unsigned int jiffies_to_usecs(const unsigned long j); |
| 297 | |||
| 298 | static inline u64 jiffies_to_nsecs(const unsigned long j) | ||
| 299 | { | ||
| 300 | return (u64)jiffies_to_usecs(j) * NSEC_PER_USEC; | ||
| 301 | } | ||
| 302 | |||
| 297 | extern unsigned long msecs_to_jiffies(const unsigned int m); | 303 | extern unsigned long msecs_to_jiffies(const unsigned int m); |
| 298 | extern unsigned long usecs_to_jiffies(const unsigned int u); | 304 | extern unsigned long usecs_to_jiffies(const unsigned int u); |
| 299 | extern unsigned long timespec_to_jiffies(const struct timespec *value); | 305 | extern 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); | |||
| 104 | extern void tick_clock_notify(void); | 104 | extern void tick_clock_notify(void); |
| 105 | extern int tick_check_oneshot_change(int allow_nohz); | 105 | extern int tick_check_oneshot_change(int allow_nohz); |
| 106 | extern struct tick_sched *tick_get_tick_sched(int cpu); | 106 | extern struct tick_sched *tick_get_tick_sched(int cpu); |
| 107 | extern void tick_check_idle(void); | 107 | extern void tick_irq_enter(void); |
| 108 | extern int tick_oneshot_mode_active(void); | 108 | extern 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 |
| 113 | static inline void tick_clock_notify(void) { } | 113 | static inline void tick_clock_notify(void) { } |
| 114 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | 114 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } |
| 115 | static inline void tick_check_idle(void) { } | 115 | static inline void tick_irq_enter(void) { } |
| 116 | static inline int tick_oneshot_mode_active(void) { return 0; } | 116 | static 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) { } | |||
| 121 | static inline void tick_cancel_sched_timer(int cpu) { } | 121 | static inline void tick_cancel_sched_timer(int cpu) { } |
| 122 | static inline void tick_clock_notify(void) { } | 122 | static inline void tick_clock_notify(void) { } |
| 123 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | 123 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } |
| 124 | static inline void tick_check_idle(void) { } | 124 | static inline void tick_irq_enter(void) { } |
| 125 | static inline int tick_oneshot_mode_active(void) { return 0; } | 125 | static 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 656cd70eb577..b46131ef6aab 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -2476,7 +2476,7 @@ u64 scheduler_tick_max_deferment(void) | |||
| 2476 | if (time_before_eq(next, now)) | 2476 | if (time_before_eq(next, now)) |
| 2477 | return 0; | 2477 | return 0; |
| 2478 | 2478 | ||
| 2479 | return jiffies_to_usecs(next - now) * NSEC_PER_USEC; | 2479 | return jiffies_to_nsecs(next - now); |
| 2480 | } | 2480 | } |
| 2481 | #endif | 2481 | #endif |
| 2482 | 2482 | ||
diff --git a/kernel/softirq.c b/kernel/softirq.c index 850967068aaf..490fcbb1dc5b 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
| @@ -328,7 +328,7 @@ void irq_enter(void) | |||
| 328 | * here, as softirq will be serviced on return from interrupt. | 328 | * here, as softirq will be serviced on return from interrupt. |
| 329 | */ | 329 | */ |
| 330 | local_bh_disable(); | 330 | local_bh_disable(); |
| 331 | tick_check_idle(); | 331 | tick_irq_enter(); |
| 332 | _local_bh_enable(); | 332 | _local_bh_enable(); |
| 333 | } | 333 | } |
| 334 | 334 | ||
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: | |||
| 678 | static void tick_nohz_full_stop_tick(struct tick_sched *ts) | 679 | static 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 | ||
| 1026 | static inline void tick_check_nohz_this_cpu(void) | 1027 | static 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 | ||
| 1044 | static inline void tick_nohz_switch_to_nohz(void) { } | 1045 | static inline void tick_nohz_switch_to_nohz(void) { } |
| 1045 | static inline void tick_check_nohz_this_cpu(void) { } | 1046 | static 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 | */ |
| 1052 | void tick_check_idle(void) | 1053 | void 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 | /* |
