Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nohz: Rename CONFIG_NO_HZ to CONFIG_NO_HZ_COMMON

We are planning to convert the dynticks Kconfig options layout
into a choice menu. The user must be able to easily pick
any of the following implementations: constant periodic tick,
idle dynticks, full dynticks.

As this implies a mutual exclusion, the two dynticks implementions
need to converge on the selection of a common Kconfig option in order
to ease the sharing of a common infrastructure.

It would thus seem pretty natural to reuse CONFIG_NO_HZ to
that end. It already implements all the idle dynticks code
and the full dynticks depends on all that code for now.
So ideally the choice menu would propose CONFIG_NO_HZ_IDLE and
CONFIG_NO_HZ_EXTENDED then both would select CONFIG_NO_HZ.

On the other hand we want to stay backward compatible: if
CONFIG_NO_HZ is set in an older config file, we want to
enable CONFIG_NO_HZ_IDLE by default.

But we can't afford both at the same time or we run into
a circular dependency:

1) CONFIG_NO_HZ_IDLE and CONFIG_NO_HZ_EXTENDED both select
CONFIG_NO_HZ
2) If CONFIG_NO_HZ is set, we default to CONFIG_NO_HZ_IDLE

We might be able to support that from Kconfig/Kbuild but it
may not be wise to introduce such a confusing behaviour.

So to solve this, create a new CONFIG_NO_HZ_COMMON option
which gathers the common code between idle and full dynticks
(that common code for now is simply the idle dynticks code)
and select it from their referring Kconfig.

Then we'll later create CONFIG_NO_HZ_IDLE and map CONFIG_NO_HZ
to it for backward compatibility.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Geoff Levand <geoff@infradead.org>
Cc: Gilad Ben Yossef <gilad@benyossef.com>
Cc: Hakan Akkan <hakanakkan@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kevin Hilman <khilman@linaro.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>

+51 -46
+1 -1
Documentation/RCU/stallwarn.txt
··· 176 176 o A hardware or software issue shuts off the scheduler-clock 177 177 interrupt on a CPU that is not in dyntick-idle mode. This 178 178 problem really has happened, and seems to be most likely to 179 - result in RCU CPU stall warnings for CONFIG_NO_HZ=n kernels. 179 + result in RCU CPU stall warnings for CONFIG_NO_HZ_COMMON=n kernels. 180 180 181 181 o A bug in the RCU implementation. 182 182
+2 -2
Documentation/cpu-freq/governors.txt
··· 131 131 The sampling rate is limited by the HW transition latency: 132 132 transition_latency * 100 133 133 Or by kernel restrictions: 134 - If CONFIG_NO_HZ is set, the limit is 10ms fixed. 135 - If CONFIG_NO_HZ is not set or nohz=off boot parameter is used, the 134 + If CONFIG_NO_HZ_COMMON is set, the limit is 10ms fixed. 135 + If CONFIG_NO_HZ_COMMON is not set or nohz=off boot parameter is used, the 136 136 limits depend on the CONFIG_HZ option: 137 137 HZ=1000: min=20000us (20ms) 138 138 HZ=250: min=80000us (80ms)
+2 -2
arch/um/include/shared/common-offsets.h
··· 30 30 #ifdef CONFIG_PRINTK 31 31 DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK); 32 32 #endif 33 - #ifdef CONFIG_NO_HZ 34 - DEFINE(UML_CONFIG_NO_HZ, CONFIG_NO_HZ); 33 + #ifdef CONFIG_NO_HZ_COMMON 34 + DEFINE(UML_CONFIG_NO_HZ_COMMON, CONFIG_NO_HZ_COMMON); 35 35 #endif 36 36 #ifdef CONFIG_UML_X86 37 37 DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86);
+1 -1
arch/um/os-Linux/time.c
··· 79 79 return timeval_to_ns(&tv); 80 80 } 81 81 82 - #ifdef UML_CONFIG_NO_HZ 82 + #ifdef UML_CONFIG_NO_HZ_COMMON 83 83 static int after_sleep_interval(struct timespec *ts) 84 84 { 85 85 return 0;
+4 -4
include/linux/sched.h
··· 230 230 231 231 extern int runqueue_is_locked(int cpu); 232 232 233 - #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 233 + #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) 234 234 extern void nohz_balance_enter_idle(int cpu); 235 235 extern void set_cpu_sd_state_idle(void); 236 236 extern int get_nohz_timer_target(void); ··· 1758 1758 } 1759 1759 #endif 1760 1760 1761 - #ifdef CONFIG_NO_HZ 1761 + #ifdef CONFIG_NO_HZ_COMMON 1762 1762 void calc_load_enter_idle(void); 1763 1763 void calc_load_exit_idle(void); 1764 1764 #else 1765 1765 static inline void calc_load_enter_idle(void) { } 1766 1766 static inline void calc_load_exit_idle(void) { } 1767 - #endif /* CONFIG_NO_HZ */ 1767 + #endif /* CONFIG_NO_HZ_COMMON */ 1768 1768 1769 1769 #ifndef CONFIG_CPUMASK_OFFSTACK 1770 1770 static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) ··· 1850 1850 static inline void idle_task_exit(void) {} 1851 1851 #endif 1852 1852 1853 - #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) 1853 + #if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP) 1854 1854 extern void wake_up_nohz_cpu(int cpu); 1855 1855 #else 1856 1856 static inline void wake_up_nohz_cpu(int cpu) { }
+4 -4
include/linux/tick.h
··· 82 82 extern void tick_setup_sched_timer(void); 83 83 # endif 84 84 85 - # if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS 85 + # if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS 86 86 extern void tick_cancel_sched_timer(int cpu); 87 87 # else 88 88 static inline void tick_cancel_sched_timer(int cpu) { } ··· 123 123 static inline int tick_oneshot_mode_active(void) { return 0; } 124 124 #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 125 125 126 - # ifdef CONFIG_NO_HZ 126 + # ifdef CONFIG_NO_HZ_COMMON 127 127 DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched); 128 128 129 129 static inline int tick_nohz_tick_stopped(void) ··· 138 138 extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 139 139 extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 140 140 141 - # else /* !CONFIG_NO_HZ */ 141 + # else /* !CONFIG_NO_HZ_COMMON */ 142 142 static inline int tick_nohz_tick_stopped(void) 143 143 { 144 144 return 0; ··· 155 155 } 156 156 static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } 157 157 static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } 158 - # endif /* !NO_HZ */ 158 + # endif /* !CONFIG_NO_HZ_COMMON */ 159 159 160 160 #ifdef CONFIG_NO_HZ_EXTENDED 161 161 extern int tick_nohz_extended_cpu(int cpu);
+1 -1
init/Kconfig
··· 580 580 581 581 config RCU_FAST_NO_HZ 582 582 bool "Accelerate last non-dyntick-idle CPU's grace periods" 583 - depends on NO_HZ && SMP 583 + depends on NO_HZ_COMMON && SMP 584 584 default n 585 585 help 586 586 This option causes RCU to attempt to accelerate grace periods in
+2 -2
kernel/hrtimer.c
··· 160 160 */ 161 161 static int hrtimer_get_target(int this_cpu, int pinned) 162 162 { 163 - #ifdef CONFIG_NO_HZ 163 + #ifdef CONFIG_NO_HZ_COMMON 164 164 if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu)) 165 165 return get_nohz_timer_target(); 166 166 #endif ··· 1106 1106 } 1107 1107 EXPORT_SYMBOL_GPL(hrtimer_get_remaining); 1108 1108 1109 - #ifdef CONFIG_NO_HZ 1109 + #ifdef CONFIG_NO_HZ_COMMON 1110 1110 /** 1111 1111 * hrtimer_get_next_event - get the time until next expiry event 1112 1112 *
+9 -9
kernel/sched/core.c
··· 549 549 raw_spin_unlock_irqrestore(&rq->lock, flags); 550 550 } 551 551 552 - #ifdef CONFIG_NO_HZ 552 + #ifdef CONFIG_NO_HZ_COMMON 553 553 /* 554 554 * In the semi idle case, use the nearest busy cpu for migrating timers 555 555 * from an idle cpu. This is good for power-savings. ··· 641 641 return idle_cpu(cpu) && test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu)); 642 642 } 643 643 644 - #else /* CONFIG_NO_HZ */ 644 + #else /* CONFIG_NO_HZ_COMMON */ 645 645 646 646 static inline bool got_nohz_idle_kick(void) 647 647 { 648 648 return false; 649 649 } 650 650 651 - #endif /* CONFIG_NO_HZ */ 651 + #endif /* CONFIG_NO_HZ_COMMON */ 652 652 653 653 void sched_avg_update(struct rq *rq) 654 654 { ··· 2139 2139 return load >> FSHIFT; 2140 2140 } 2141 2141 2142 - #ifdef CONFIG_NO_HZ 2142 + #ifdef CONFIG_NO_HZ_COMMON 2143 2143 /* 2144 2144 * Handle NO_HZ for the global load-average. 2145 2145 * ··· 2365 2365 smp_wmb(); 2366 2366 calc_load_idx++; 2367 2367 } 2368 - #else /* !CONFIG_NO_HZ */ 2368 + #else /* !CONFIG_NO_HZ_COMMON */ 2369 2369 2370 2370 static inline long calc_load_fold_idle(void) { return 0; } 2371 2371 static inline void calc_global_nohz(void) { } 2372 2372 2373 - #endif /* CONFIG_NO_HZ */ 2373 + #endif /* CONFIG_NO_HZ_COMMON */ 2374 2374 2375 2375 /* 2376 2376 * calc_load - update the avenrun load estimates 10 ticks after the ··· 2530 2530 sched_avg_update(this_rq); 2531 2531 } 2532 2532 2533 - #ifdef CONFIG_NO_HZ 2533 + #ifdef CONFIG_NO_HZ_COMMON 2534 2534 /* 2535 2535 * There is no sane way to deal with nohz on smp when using jiffies because the 2536 2536 * cpu doing the jiffies update might drift wrt the cpu doing the jiffy reading ··· 2590 2590 } 2591 2591 raw_spin_unlock(&this_rq->lock); 2592 2592 } 2593 - #endif /* CONFIG_NO_HZ */ 2593 + #endif /* CONFIG_NO_HZ_COMMON */ 2594 2594 2595 2595 /* 2596 2596 * Called from scheduler_tick() ··· 7023 7023 INIT_LIST_HEAD(&rq->cfs_tasks); 7024 7024 7025 7025 rq_attach_root(rq, &def_root_domain); 7026 - #ifdef CONFIG_NO_HZ 7026 + #ifdef CONFIG_NO_HZ_COMMON 7027 7027 rq->nohz_flags = 0; 7028 7028 #endif 7029 7029 #endif
+5 -5
kernel/sched/fair.c
··· 5331 5331 return 0; 5332 5332 } 5333 5333 5334 - #ifdef CONFIG_NO_HZ 5334 + #ifdef CONFIG_NO_HZ_COMMON 5335 5335 /* 5336 5336 * idle load balancing details 5337 5337 * - When one of the busy CPUs notice that there may be an idle rebalancing ··· 5541 5541 rq->next_balance = next_balance; 5542 5542 } 5543 5543 5544 - #ifdef CONFIG_NO_HZ 5544 + #ifdef CONFIG_NO_HZ_COMMON 5545 5545 /* 5546 - * In CONFIG_NO_HZ case, the idle balance kickee will do the 5546 + * In CONFIG_NO_HZ_COMMON case, the idle balance kickee will do the 5547 5547 * rebalancing for all the cpus for whom scheduler ticks are stopped. 5548 5548 */ 5549 5549 static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle) ··· 5686 5686 if (time_after_eq(jiffies, rq->next_balance) && 5687 5687 likely(!on_null_domain(cpu))) 5688 5688 raise_softirq(SCHED_SOFTIRQ); 5689 - #ifdef CONFIG_NO_HZ 5689 + #ifdef CONFIG_NO_HZ_COMMON 5690 5690 if (nohz_kick_needed(rq, cpu) && likely(!on_null_domain(cpu))) 5691 5691 nohz_balancer_kick(cpu); 5692 5692 #endif ··· 6156 6156 #ifdef CONFIG_SMP 6157 6157 open_softirq(SCHED_SOFTIRQ, run_rebalance_domains); 6158 6158 6159 - #ifdef CONFIG_NO_HZ 6159 + #ifdef CONFIG_NO_HZ_COMMON 6160 6160 nohz.next_balance = jiffies; 6161 6161 zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT); 6162 6162 cpu_notifier(sched_ilb_notifier, 0);
+2 -2
kernel/sched/sched.h
··· 404 404 #define CPU_LOAD_IDX_MAX 5 405 405 unsigned long cpu_load[CPU_LOAD_IDX_MAX]; 406 406 unsigned long last_load_update_tick; 407 - #ifdef CONFIG_NO_HZ 407 + #ifdef CONFIG_NO_HZ_COMMON 408 408 u64 nohz_stamp; 409 409 unsigned long nohz_flags; 410 410 #endif ··· 1333 1333 1334 1334 extern void account_cfs_bandwidth_used(int enabled, int was_enabled); 1335 1335 1336 - #ifdef CONFIG_NO_HZ 1336 + #ifdef CONFIG_NO_HZ_COMMON 1337 1337 enum rq_nohz_flag_bits { 1338 1338 NOHZ_TICK_STOPPED, 1339 1339 NOHZ_BALANCE_KICK,
+1 -1
kernel/softirq.c
··· 348 348 if (!in_interrupt() && local_softirq_pending()) 349 349 invoke_softirq(); 350 350 351 - #ifdef CONFIG_NO_HZ 351 + #ifdef CONFIG_NO_HZ_COMMON 352 352 /* Make sure that timer wheel updates are propagated */ 353 353 if (idle_cpu(smp_processor_id()) && !in_interrupt() && !need_resched()) 354 354 tick_nohz_irq_exit();
+9 -4
kernel/time/Kconfig
··· 64 64 if GENERIC_CLOCKEVENTS 65 65 menu "Timers subsystem" 66 66 67 - # Core internal switch. Selected by NO_HZ / HIGH_RES_TIMERS. This is 67 + # Core internal switch. Selected by NO_HZ_COMMON / HIGH_RES_TIMERS. This is 68 68 # only related to the tick functionality. Oneshot clockevent devices 69 69 # are supported independ of this. 70 70 config TICK_ONESHOT 71 71 bool 72 72 73 + config NO_HZ_COMMON 74 + bool 75 + depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS 76 + select TICK_ONESHOT 77 + 73 78 config NO_HZ 74 79 bool "Tickless System (Dynamic Ticks)" 75 80 depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS 76 - select TICK_ONESHOT 81 + select NO_HZ_COMMON 77 82 help 78 83 This option enables a tickless system: timer interrupts will 79 84 only trigger on an as-needed basis both when the system is ··· 86 81 87 82 config NO_HZ_EXTENDED 88 83 bool "Full dynticks system" 89 - # NO_HZ dependency 84 + # NO_HZ_COMMON dependency 90 85 depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS 91 86 # RCU_USER_QS 92 87 depends on HAVE_CONTEXT_TRACKING && SMP 93 88 # RCU_NOCB_CPU dependency 94 89 depends on TREE_RCU || TREE_PREEMPT_RCU 95 90 depends on VIRT_CPU_ACCOUNTING_GEN 96 - select NO_HZ 91 + select NO_HZ_COMMON 97 92 select RCU_USER_QS 98 93 select RCU_NOCB_CPU 99 94 select CONTEXT_TRACKING_FORCE
+6 -6
kernel/time/tick-sched.c
··· 104 104 { 105 105 int cpu = smp_processor_id(); 106 106 107 - #ifdef CONFIG_NO_HZ 107 + #ifdef CONFIG_NO_HZ_COMMON 108 108 /* 109 109 * Check if the do_timer duty was dropped. We don't care about 110 110 * concurrency: This happens only when the cpu in charge went ··· 124 124 125 125 static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs) 126 126 { 127 - #ifdef CONFIG_NO_HZ 127 + #ifdef CONFIG_NO_HZ_COMMON 128 128 /* 129 129 * When we are idle and the tick is stopped, we have to touch 130 130 * the watchdog as we might not schedule for a really long ··· 235 235 /* 236 236 * NOHZ - aka dynamic tick functionality 237 237 */ 238 - #ifdef CONFIG_NO_HZ 238 + #ifdef CONFIG_NO_HZ_COMMON 239 239 /* 240 240 * NO HZ enabled ? 241 241 */ ··· 907 907 static inline void tick_nohz_switch_to_nohz(void) { } 908 908 static inline void tick_check_nohz(int cpu) { } 909 909 910 - #endif /* NO_HZ */ 910 + #endif /* CONFIG_NO_HZ_COMMON */ 911 911 912 912 /* 913 913 * Called from irq_enter to notify about the possible interruption of idle() ··· 992 992 now = ktime_get(); 993 993 } 994 994 995 - #ifdef CONFIG_NO_HZ 995 + #ifdef CONFIG_NO_HZ_COMMON 996 996 if (tick_nohz_enabled) 997 997 ts->nohz_mode = NOHZ_MODE_HIGHRES; 998 998 #endif 999 999 } 1000 1000 #endif /* HIGH_RES_TIMERS */ 1001 1001 1002 - #if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS 1002 + #if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS 1003 1003 void tick_cancel_sched_timer(int cpu) 1004 1004 { 1005 1005 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+2 -2
kernel/timer.c
··· 738 738 739 739 cpu = smp_processor_id(); 740 740 741 - #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) 741 + #if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP) 742 742 if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) 743 743 cpu = get_nohz_timer_target(); 744 744 #endif ··· 1188 1188 spin_unlock_irq(&base->lock); 1189 1189 } 1190 1190 1191 - #ifdef CONFIG_NO_HZ 1191 + #ifdef CONFIG_NO_HZ_COMMON 1192 1192 /* 1193 1193 * Find out when the next timer event is due to happen. This 1194 1194 * is used on S/390 to stop all activity when a CPU is idle.