Skip to content

Commit 3451d02

Browse files
committed
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>
1 parent ab71d36 commit 3451d02

15 files changed

Lines changed: 51 additions & 46 deletions

File tree

‎Documentation/RCU/stallwarn.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ o A CPU-bound real-time task in a CONFIG_PREEMPT_RT kernel that
176176
o A hardware or software issue shuts off the scheduler-clock
177177
interrupt on a CPU that is not in dyntick-idle mode. This
178178
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.
180180

181181
o A bug in the RCU implementation.
182182

‎Documentation/cpu-freq/governors.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ sampling_rate_min:
131131
The sampling rate is limited by the HW transition latency:
132132
transition_latency * 100
133133
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
136136
limits depend on the CONFIG_HZ option:
137137
HZ=1000: min=20000us (20ms)
138138
HZ=250: min=80000us (80ms)

‎arch/um/include/shared/common-offsets.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC);
3030
#ifdef CONFIG_PRINTK
3131
DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK);
3232
#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);
3535
#endif
3636
#ifdef CONFIG_UML_X86
3737
DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86);

‎arch/um/os-Linux/time.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ long long os_nsecs(void)
7979
return timeval_to_ns(&tv);
8080
}
8181

82-
#ifdef UML_CONFIG_NO_HZ
82+
#ifdef UML_CONFIG_NO_HZ_COMMON
8383
static int after_sleep_interval(struct timespec *ts)
8484
{
8585
return 0;

‎include/linux/sched.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ extern void init_idle_bootup_task(struct task_struct *idle);
230230

231231
extern int runqueue_is_locked(int cpu);
232232

233-
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
233+
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
234234
extern void nohz_balance_enter_idle(int cpu);
235235
extern void set_cpu_sd_state_idle(void);
236236
extern int get_nohz_timer_target(void);
@@ -1758,13 +1758,13 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,
17581758
}
17591759
#endif
17601760

1761-
#ifdef CONFIG_NO_HZ
1761+
#ifdef CONFIG_NO_HZ_COMMON
17621762
void calc_load_enter_idle(void);
17631763
void calc_load_exit_idle(void);
17641764
#else
17651765
static inline void calc_load_enter_idle(void) { }
17661766
static inline void calc_load_exit_idle(void) { }
1767-
#endif /* CONFIG_NO_HZ */
1767+
#endif /* CONFIG_NO_HZ_COMMON */
17681768

17691769
#ifndef CONFIG_CPUMASK_OFFSTACK
17701770
static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
@@ -1850,7 +1850,7 @@ extern void idle_task_exit(void);
18501850
static inline void idle_task_exit(void) {}
18511851
#endif
18521852

1853-
#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
1853+
#if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP)
18541854
extern void wake_up_nohz_cpu(int cpu);
18551855
#else
18561856
static inline void wake_up_nohz_cpu(int cpu) { }

‎include/linux/tick.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ extern int tick_program_event(ktime_t expires, int force);
8282
extern void tick_setup_sched_timer(void);
8383
# endif
8484

85-
# if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS
85+
# if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS
8686
extern void tick_cancel_sched_timer(int cpu);
8787
# else
8888
static inline void tick_cancel_sched_timer(int cpu) { }
@@ -123,7 +123,7 @@ static inline void tick_check_idle(int cpu) { }
123123
static inline int tick_oneshot_mode_active(void) { return 0; }
124124
#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
125125

126-
# ifdef CONFIG_NO_HZ
126+
# ifdef CONFIG_NO_HZ_COMMON
127127
DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched);
128128

129129
static inline int tick_nohz_tick_stopped(void)
@@ -138,7 +138,7 @@ extern ktime_t tick_nohz_get_sleep_length(void);
138138
extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
139139
extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
140140

141-
# else /* !CONFIG_NO_HZ */
141+
# else /* !CONFIG_NO_HZ_COMMON */
142142
static inline int tick_nohz_tick_stopped(void)
143143
{
144144
return 0;
@@ -155,7 +155,7 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
155155
}
156156
static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
157157
static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
158-
# endif /* !NO_HZ */
158+
# endif /* !CONFIG_NO_HZ_COMMON */
159159

160160
#ifdef CONFIG_NO_HZ_EXTENDED
161161
extern int tick_nohz_extended_cpu(int cpu);

‎init/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ config RCU_FANOUT_EXACT
580580

581581
config RCU_FAST_NO_HZ
582582
bool "Accelerate last non-dyntick-idle CPU's grace periods"
583-
depends on NO_HZ && SMP
583+
depends on NO_HZ_COMMON && SMP
584584
default n
585585
help
586586
This option causes RCU to attempt to accelerate grace periods in

‎kernel/hrtimer.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,
160160
*/
161161
static int hrtimer_get_target(int this_cpu, int pinned)
162162
{
163-
#ifdef CONFIG_NO_HZ
163+
#ifdef CONFIG_NO_HZ_COMMON
164164
if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu))
165165
return get_nohz_timer_target();
166166
#endif
@@ -1106,7 +1106,7 @@ ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
11061106
}
11071107
EXPORT_SYMBOL_GPL(hrtimer_get_remaining);
11081108

1109-
#ifdef CONFIG_NO_HZ
1109+
#ifdef CONFIG_NO_HZ_COMMON
11101110
/**
11111111
* hrtimer_get_next_event - get the time until next expiry event
11121112
*

‎kernel/sched/core.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ void resched_cpu(int cpu)
549549
raw_spin_unlock_irqrestore(&rq->lock, flags);
550550
}
551551

552-
#ifdef CONFIG_NO_HZ
552+
#ifdef CONFIG_NO_HZ_COMMON
553553
/*
554554
* In the semi idle case, use the nearest busy cpu for migrating timers
555555
* from an idle cpu. This is good for power-savings.
@@ -641,14 +641,14 @@ static inline bool got_nohz_idle_kick(void)
641641
return idle_cpu(cpu) && test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu));
642642
}
643643

644-
#else /* CONFIG_NO_HZ */
644+
#else /* CONFIG_NO_HZ_COMMON */
645645

646646
static inline bool got_nohz_idle_kick(void)
647647
{
648648
return false;
649649
}
650650

651-
#endif /* CONFIG_NO_HZ */
651+
#endif /* CONFIG_NO_HZ_COMMON */
652652

653653
void sched_avg_update(struct rq *rq)
654654
{
@@ -2139,7 +2139,7 @@ calc_load(unsigned long load, unsigned long exp, unsigned long active)
21392139
return load >> FSHIFT;
21402140
}
21412141

2142-
#ifdef CONFIG_NO_HZ
2142+
#ifdef CONFIG_NO_HZ_COMMON
21432143
/*
21442144
* Handle NO_HZ for the global load-average.
21452145
*
@@ -2365,12 +2365,12 @@ static void calc_global_nohz(void)
23652365
smp_wmb();
23662366
calc_load_idx++;
23672367
}
2368-
#else /* !CONFIG_NO_HZ */
2368+
#else /* !CONFIG_NO_HZ_COMMON */
23692369

23702370
static inline long calc_load_fold_idle(void) { return 0; }
23712371
static inline void calc_global_nohz(void) { }
23722372

2373-
#endif /* CONFIG_NO_HZ */
2373+
#endif /* CONFIG_NO_HZ_COMMON */
23742374

23752375
/*
23762376
* calc_load - update the avenrun load estimates 10 ticks after the
@@ -2530,7 +2530,7 @@ static void __update_cpu_load(struct rq *this_rq, unsigned long this_load,
25302530
sched_avg_update(this_rq);
25312531
}
25322532

2533-
#ifdef CONFIG_NO_HZ
2533+
#ifdef CONFIG_NO_HZ_COMMON
25342534
/*
25352535
* There is no sane way to deal with nohz on smp when using jiffies because the
25362536
* cpu doing the jiffies update might drift wrt the cpu doing the jiffy reading
@@ -2590,7 +2590,7 @@ void update_cpu_load_nohz(void)
25902590
}
25912591
raw_spin_unlock(&this_rq->lock);
25922592
}
2593-
#endif /* CONFIG_NO_HZ */
2593+
#endif /* CONFIG_NO_HZ_COMMON */
25942594

25952595
/*
25962596
* Called from scheduler_tick()
@@ -7023,7 +7023,7 @@ void __init sched_init(void)
70237023
INIT_LIST_HEAD(&rq->cfs_tasks);
70247024

70257025
rq_attach_root(rq, &def_root_domain);
7026-
#ifdef CONFIG_NO_HZ
7026+
#ifdef CONFIG_NO_HZ_COMMON
70277027
rq->nohz_flags = 0;
70287028
#endif
70297029
#endif

‎kernel/sched/fair.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5331,7 +5331,7 @@ static int active_load_balance_cpu_stop(void *data)
53315331
return 0;
53325332
}
53335333

5334-
#ifdef CONFIG_NO_HZ
5334+
#ifdef CONFIG_NO_HZ_COMMON
53355335
/*
53365336
* idle load balancing details
53375337
* - When one of the busy CPUs notice that there may be an idle rebalancing
@@ -5541,9 +5541,9 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
55415541
rq->next_balance = next_balance;
55425542
}
55435543

5544-
#ifdef CONFIG_NO_HZ
5544+
#ifdef CONFIG_NO_HZ_COMMON
55455545
/*
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
55475547
* rebalancing for all the cpus for whom scheduler ticks are stopped.
55485548
*/
55495549
static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle)
@@ -5686,7 +5686,7 @@ void trigger_load_balance(struct rq *rq, int cpu)
56865686
if (time_after_eq(jiffies, rq->next_balance) &&
56875687
likely(!on_null_domain(cpu)))
56885688
raise_softirq(SCHED_SOFTIRQ);
5689-
#ifdef CONFIG_NO_HZ
5689+
#ifdef CONFIG_NO_HZ_COMMON
56905690
if (nohz_kick_needed(rq, cpu) && likely(!on_null_domain(cpu)))
56915691
nohz_balancer_kick(cpu);
56925692
#endif
@@ -6156,7 +6156,7 @@ __init void init_sched_fair_class(void)
61566156
#ifdef CONFIG_SMP
61576157
open_softirq(SCHED_SOFTIRQ, run_rebalance_domains);
61586158

6159-
#ifdef CONFIG_NO_HZ
6159+
#ifdef CONFIG_NO_HZ_COMMON
61606160
nohz.next_balance = jiffies;
61616161
zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT);
61626162
cpu_notifier(sched_ilb_notifier, 0);

0 commit comments

Comments
 (0)