Skip to content

Commit a8b7691

Browse files
Valentin SchneiderPeter Zijlstra
authored andcommitted
preempt: Restore preemption model selection configs
Commit c597bfd ("sched: Provide Kconfig support for default dynamic preempt mode") changed the selectable config names for the preemption model. This means a config file must now select CONFIG_PREEMPT_BEHAVIOUR=y rather than CONFIG_PREEMPT=y to get a preemptible kernel. This means all arch config files would need to be updated - right now they'll all end up with the default CONFIG_PREEMPT_NONE_BEHAVIOUR. Rather than touch a good hundred of config files, restore usage of CONFIG_PREEMPT{_NONE, _VOLUNTARY}. Make them configure: o The build-time preemption model when !PREEMPT_DYNAMIC o The default boot-time preemption model when PREEMPT_DYNAMIC Add siblings of those configs with the _BUILD suffix to unconditionally designate the build-time preemption model (PREEMPT_DYNAMIC is built with the "highest" preemption model it supports, aka PREEMPT). Downstream configs should by now all be depending / selected by CONFIG_PREEMPTION rather than CONFIG_PREEMPT, so only a few sites need patching up. Signed-off-by: Valentin Schneider <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Marco Elver <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4cc4cc2 commit a8b7691

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

include/linux/kernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
struct completion;
8686
struct user;
8787

88-
#ifdef CONFIG_PREEMPT_VOLUNTARY
88+
#ifdef CONFIG_PREEMPT_VOLUNTARY_BUILD
8989

9090
extern int __cond_resched(void);
9191
# define might_resched() __cond_resched()

include/linux/vermagic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#else
1616
#define MODULE_VERMAGIC_SMP ""
1717
#endif
18-
#ifdef CONFIG_PREEMPT
18+
#ifdef CONFIG_PREEMPT_BUILD
1919
#define MODULE_VERMAGIC_PREEMPT "preempt "
2020
#elif defined(CONFIG_PREEMPT_RT)
2121
#define MODULE_VERMAGIC_PREEMPT "preempt_rt "

init/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $(obj)/version.o: include/generated/compile.h
3030
quiet_cmd_compile.h = CHK $@
3131
cmd_compile.h = \
3232
$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
33-
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" \
33+
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)" \
3434
"$(CONFIG_PREEMPT_RT)" $(CONFIG_CC_VERSION_TEXT) "$(LD)"
3535

3636
include/generated/compile.h: FORCE

kernel/Kconfig.preempt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22

3+
config PREEMPT_NONE_BUILD
4+
bool
5+
6+
config PREEMPT_VOLUNTARY_BUILD
7+
bool
8+
9+
config PREEMPT_BUILD
10+
bool
11+
select PREEMPTION
12+
select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
13+
314
choice
415
prompt "Preemption Model"
5-
default PREEMPT_NONE_BEHAVIOUR
16+
default PREEMPT_NONE
617

7-
config PREEMPT_NONE_BEHAVIOUR
18+
config PREEMPT_NONE
819
bool "No Forced Preemption (Server)"
9-
select PREEMPT_NONE if !PREEMPT_DYNAMIC
20+
select PREEMPT_NONE_BUILD if !PREEMPT_DYNAMIC
1021
help
1122
This is the traditional Linux preemption model, geared towards
1223
throughput. It will still provide good latencies most of the
@@ -18,10 +29,10 @@ config PREEMPT_NONE_BEHAVIOUR
1829
raw processing power of the kernel, irrespective of scheduling
1930
latencies.
2031

21-
config PREEMPT_VOLUNTARY_BEHAVIOUR
32+
config PREEMPT_VOLUNTARY
2233
bool "Voluntary Kernel Preemption (Desktop)"
2334
depends on !ARCH_NO_PREEMPT
24-
select PREEMPT_VOLUNTARY if !PREEMPT_DYNAMIC
35+
select PREEMPT_VOLUNTARY_BUILD if !PREEMPT_DYNAMIC
2536
help
2637
This option reduces the latency of the kernel by adding more
2738
"explicit preemption points" to the kernel code. These new
@@ -37,10 +48,10 @@ config PREEMPT_VOLUNTARY_BEHAVIOUR
3748

3849
Select this if you are building a kernel for a desktop system.
3950

40-
config PREEMPT_BEHAVIOUR
51+
config PREEMPT
4152
bool "Preemptible Kernel (Low-Latency Desktop)"
4253
depends on !ARCH_NO_PREEMPT
43-
select PREEMPT
54+
select PREEMPT_BUILD
4455
help
4556
This option reduces the latency of the kernel by making
4657
all kernel code (that is not executing in a critical section)
@@ -58,7 +69,7 @@ config PREEMPT_BEHAVIOUR
5869

5970
config PREEMPT_RT
6071
bool "Fully Preemptible Kernel (Real-Time)"
61-
depends on EXPERT && ARCH_SUPPORTS_RT && !PREEMPT_DYNAMIC
72+
depends on EXPERT && ARCH_SUPPORTS_RT
6273
select PREEMPTION
6374
help
6475
This option turns the kernel into a real-time kernel by replacing
@@ -75,17 +86,6 @@ config PREEMPT_RT
7586

7687
endchoice
7788

78-
config PREEMPT_NONE
79-
bool
80-
81-
config PREEMPT_VOLUNTARY
82-
bool
83-
84-
config PREEMPT
85-
bool
86-
select PREEMPTION
87-
select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
88-
8989
config PREEMPT_COUNT
9090
bool
9191

@@ -95,8 +95,8 @@ config PREEMPTION
9595

9696
config PREEMPT_DYNAMIC
9797
bool "Preemption behaviour defined on boot"
98-
depends on HAVE_PREEMPT_DYNAMIC
99-
select PREEMPT
98+
depends on HAVE_PREEMPT_DYNAMIC && !PREEMPT_RT
99+
select PREEMPT_BUILD
100100
default y
101101
help
102102
This option allows to define the preemption model on the kernel

kernel/sched/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6628,13 +6628,13 @@ __setup("preempt=", setup_preempt_mode);
66286628
static void __init preempt_dynamic_init(void)
66296629
{
66306630
if (preempt_dynamic_mode == preempt_dynamic_undefined) {
6631-
if (IS_ENABLED(CONFIG_PREEMPT_NONE_BEHAVIOUR)) {
6631+
if (IS_ENABLED(CONFIG_PREEMPT_NONE)) {
66326632
sched_dynamic_update(preempt_dynamic_none);
6633-
} else if (IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY_BEHAVIOUR)) {
6633+
} else if (IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY)) {
66346634
sched_dynamic_update(preempt_dynamic_voluntary);
66356635
} else {
66366636
/* Default static call setting, nothing to do */
6637-
WARN_ON_ONCE(!IS_ENABLED(CONFIG_PREEMPT_BEHAVIOUR));
6637+
WARN_ON_ONCE(!IS_ENABLED(CONFIG_PREEMPT));
66386638
preempt_dynamic_mode = preempt_dynamic_full;
66396639
pr_info("Dynamic Preempt: full\n");
66406640
}

0 commit comments

Comments
 (0)