* [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption
@ 2024-02-23 0:26 Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 1/4] rcu: Create NEED_TASKS_RCU to factor out enablement logic Paul E. McKenney
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Paul E. McKenney @ 2024-02-23 0:26 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, ankur.a.arora, tglx,
mark.rutland
Hello!
This series refactors the NEED_TASKS_RCU option so that the conditional
processing is in one place in kernel/rcu/Kconfig. This makes it easier
to make sure that Tasks RCU is enabled in PREEMPT_AUTO kernels, given
that such kernels are preemptible, even if only lazily so. After all,
it takes only one lazy preemption from a trampoline to significantly
degrade your kernel's actuarial statistics.
1. Create NEED_TASKS_RCU to factor out enablement logic.
2. Select new NEED_TASKS_RCU Kconfig option.
3. Select new NEED_TASKS_RCU Kconfig option.
4. Select new NEED_TASKS_RCU Kconfig option.
Thanx, Paul
------------------------------------------------------------------------
arch/Kconfig | 4 ++--
kernel/bpf/Kconfig | 2 +-
kernel/rcu/Kconfig | 6 +++++-
kernel/trace/Kconfig | 4 ++--
4 files changed, 10 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH rcu 1/4] rcu: Create NEED_TASKS_RCU to factor out enablement logic
2024-02-23 0:26 [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Paul E. McKenney
@ 2024-02-23 0:26 ` Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 2/4] bpf: Select new NEED_TASKS_RCU Kconfig option Paul E. McKenney
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Paul E. McKenney @ 2024-02-23 0:26 UTC (permalink / raw)
To: rcu
Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney, Ankur Arora,
Thomas Gleixner, Mark Rutland
Currently, if a Kconfig option depends on TASKS_RCU, it conditionally does
"select TASKS_RCU if PREEMPTION". This works, but requires any change in
this enablement logic to be replicated across all such "select" clauses.
This commit therefore creates a new NEED_TASKS_RCU Kconfig option so
that the default value of TASKS_RCU can depend on a combination of this
new option and any needed enablement logic, so that this logic is in
one place.
While in the area, also anticipate a likely future change by adding
PREEMPT_AUTO to that logic.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Ankur Arora <ankur.a.arora@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
kernel/rcu/Kconfig | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index 7dca0138260c3..3e079de0f5b43 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -85,9 +85,13 @@ config FORCE_TASKS_RCU
idle, and user-mode execution as quiescent states. Not for
manual selection in most cases.
-config TASKS_RCU
+config NEED_TASKS_RCU
bool
default n
+
+config TASKS_RCU
+ bool
+ default NEED_TASKS_RCU && (PREEMPTION || PREEMPT_AUTO)
select IRQ_WORK
config FORCE_TASKS_RUDE_RCU
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH rcu 2/4] bpf: Select new NEED_TASKS_RCU Kconfig option
2024-02-23 0:26 [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 1/4] rcu: Create NEED_TASKS_RCU to factor out enablement logic Paul E. McKenney
@ 2024-02-23 0:26 ` Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 3/4] arch: " Paul E. McKenney
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Paul E. McKenney @ 2024-02-23 0:26 UTC (permalink / raw)
To: rcu
Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
Ankur Arora, Thomas Gleixner, Mark Rutland
Currently, if a Kconfig option depends on TASKS_RCU, it conditionally does
"select TASKS_RCU if PREEMPTION". This works, but requires any change in
this enablement logic to be replicated across all such "select" clauses.
A new NEED_TASKS_RCU Kconfig option has been created to allow this
enablement logic to be in one place in kernel/rcu/Kconfig.
Therefore, make BPF select the new NEED_TASKS_RCU Kconfig option.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Song Liu <song@kernel.org>
Cc: Yonghong Song <yonghong.song@linux.dev>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Cc: Stanislav Fomichev <sdf@google.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: <bpf@vger.kernel.org>
Cc: Ankur Arora <ankur.a.arora@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
kernel/bpf/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig
index 6a906ff930065..ce9fbc3b27ecf 100644
--- a/kernel/bpf/Kconfig
+++ b/kernel/bpf/Kconfig
@@ -27,7 +27,7 @@ config BPF_SYSCALL
bool "Enable bpf() system call"
select BPF
select IRQ_WORK
- select TASKS_RCU if PREEMPTION
+ select NEED_TASKS_RCU
select TASKS_TRACE_RCU
select BINARY_PRINTF
select NET_SOCK_MSG if NET
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH rcu 3/4] arch: Select new NEED_TASKS_RCU Kconfig option
2024-02-23 0:26 [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 1/4] rcu: Create NEED_TASKS_RCU to factor out enablement logic Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 2/4] bpf: Select new NEED_TASKS_RCU Kconfig option Paul E. McKenney
@ 2024-02-23 0:26 ` Paul E. McKenney
2024-02-23 1:36 ` Steven Rostedt
2024-02-23 0:26 ` [PATCH rcu 4/4] tracing: " Paul E. McKenney
2024-02-23 10:54 ` [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Mark Rutland
4 siblings, 1 reply; 8+ messages in thread
From: Paul E. McKenney @ 2024-02-23 0:26 UTC (permalink / raw)
To: rcu
Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney,
Andrew Morton, Thomas Gleixner, Heiko Carstens, Arnd Bergmann,
Douglas Anderson, Ankur Arora, Mark Rutland
Currently, if a Kconfig option depends on TASKS_RCU, it conditionally does
"select TASKS_RCU if PREEMPTION". This works, but requires any change in
this enablement logic to be replicated across all such "select" clauses.
A new NEED_TASKS_RCU Kconfig option has been created to allow this
enablement logic to be in one place in kernel/rcu/Kconfig.
Therefore, select the new NEED_TASKS_RCU Kconfig option instead of the
old TASKS_RCU option.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Ankur Arora <ankur.a.arora@oracle.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
arch/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index c91917b508736..154f994547632 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -55,7 +55,7 @@ config KPROBES
depends on MODULES
depends on HAVE_KPROBES
select KALLSYMS
- select TASKS_RCU if PREEMPTION
+ select NEED_TASKS_RCU
help
Kprobes allows you to trap at almost any kernel address and
execute a callback function. register_kprobe() establishes
@@ -104,7 +104,7 @@ config STATIC_CALL_SELFTEST
config OPTPROBES
def_bool y
depends on KPROBES && HAVE_OPTPROBES
- select TASKS_RCU if PREEMPTION
+ select NEED_TASKS_RCU
config KPROBES_ON_FTRACE
def_bool y
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH rcu 4/4] tracing: Select new NEED_TASKS_RCU Kconfig option
2024-02-23 0:26 [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Paul E. McKenney
` (2 preceding siblings ...)
2024-02-23 0:26 ` [PATCH rcu 3/4] arch: " Paul E. McKenney
@ 2024-02-23 0:26 ` Paul E. McKenney
2024-02-23 10:54 ` [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Mark Rutland
4 siblings, 0 replies; 8+ messages in thread
From: Paul E. McKenney @ 2024-02-23 0:26 UTC (permalink / raw)
To: rcu
Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney,
Masami Hiramatsu, Mathieu Desnoyers, linux-trace-kernel,
Ankur Arora, Thomas Gleixner, Mark Rutland
Currently, if a Kconfig option depends on TASKS_RCU, it conditionally does
"select TASKS_RCU if PREEMPTION". This works, but requires any change in
this enablement logic to be replicated across all such "select" clauses.
A new NEED_TASKS_RCU Kconfig option has been created to allow this
enablement logic to be in one place in kernel/rcu/Kconfig.
Therefore, select the new NEED_TASKS_RCU Kconfig option instead of the
old TASKS_RCU option.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: <linux-trace-kernel@vger.kernel.org>
Cc: Ankur Arora <ankur.a.arora@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>
---
kernel/trace/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 61c541c36596d..6cdc5ff919b09 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -163,7 +163,7 @@ config TRACING
select BINARY_PRINTF
select EVENT_TRACING
select TRACE_CLOCK
- select TASKS_RCU if PREEMPTION
+ select NEED_TASKS_RCU
config GENERIC_TRACER
bool
@@ -204,7 +204,7 @@ config FUNCTION_TRACER
select GENERIC_TRACER
select CONTEXT_SWITCH_TRACER
select GLOB
- select TASKS_RCU if PREEMPTION
+ select NEED_TASKS_RCU
select TASKS_RUDE_RCU
help
Enable the kernel to trace every kernel function. This is done
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH rcu 3/4] arch: Select new NEED_TASKS_RCU Kconfig option
2024-02-23 0:26 ` [PATCH rcu 3/4] arch: " Paul E. McKenney
@ 2024-02-23 1:36 ` Steven Rostedt
2024-02-23 4:57 ` Paul E. McKenney
0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2024-02-23 1:36 UTC (permalink / raw)
To: Paul E. McKenney
Cc: rcu, linux-kernel, kernel-team, Andrew Morton, Thomas Gleixner,
Heiko Carstens, Arnd Bergmann, Douglas Anderson, Ankur Arora,
Mark Rutland
On Thu, 22 Feb 2024 16:26:26 -0800
"Paul E. McKenney" <paulmck@kernel.org> wrote:
> Currently, if a Kconfig option depends on TASKS_RCU, it conditionally does
> "select TASKS_RCU if PREEMPTION". This works, but requires any change in
> this enablement logic to be replicated across all such "select" clauses.
> A new NEED_TASKS_RCU Kconfig option has been created to allow this
> enablement logic to be in one place in kernel/rcu/Kconfig.
>
> Therefore, select the new NEED_TASKS_RCU Kconfig option instead of the
> old TASKS_RCU option.
>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Ankur Arora <ankur.a.arora@oracle.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-- Steve
> ---
> arch/Kconfig | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index c91917b508736..154f994547632 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -55,7 +55,7 @@ config KPROBES
> depends on MODULES
> depends on HAVE_KPROBES
> select KALLSYMS
> - select TASKS_RCU if PREEMPTION
> + select NEED_TASKS_RCU
> help
> Kprobes allows you to trap at almost any kernel address and
> execute a callback function. register_kprobe() establishes
> @@ -104,7 +104,7 @@ config STATIC_CALL_SELFTEST
> config OPTPROBES
> def_bool y
> depends on KPROBES && HAVE_OPTPROBES
> - select TASKS_RCU if PREEMPTION
> + select NEED_TASKS_RCU
>
> config KPROBES_ON_FTRACE
> def_bool y
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH rcu 3/4] arch: Select new NEED_TASKS_RCU Kconfig option
2024-02-23 1:36 ` Steven Rostedt
@ 2024-02-23 4:57 ` Paul E. McKenney
0 siblings, 0 replies; 8+ messages in thread
From: Paul E. McKenney @ 2024-02-23 4:57 UTC (permalink / raw)
To: Steven Rostedt
Cc: rcu, linux-kernel, kernel-team, Andrew Morton, Thomas Gleixner,
Heiko Carstens, Arnd Bergmann, Douglas Anderson, Ankur Arora,
Mark Rutland
On Thu, Feb 22, 2024 at 08:36:51PM -0500, Steven Rostedt wrote:
> On Thu, 22 Feb 2024 16:26:26 -0800
> "Paul E. McKenney" <paulmck@kernel.org> wrote:
>
> > Currently, if a Kconfig option depends on TASKS_RCU, it conditionally does
> > "select TASKS_RCU if PREEMPTION". This works, but requires any change in
> > this enablement logic to be replicated across all such "select" clauses.
> > A new NEED_TASKS_RCU Kconfig option has been created to allow this
> > enablement logic to be in one place in kernel/rcu/Kconfig.
> >
> > Therefore, select the new NEED_TASKS_RCU Kconfig option instead of the
> > old TASKS_RCU option.
> >
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Heiko Carstens <hca@linux.ibm.com>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Douglas Anderson <dianders@chromium.org>
> > Cc: Ankur Arora <ankur.a.arora@oracle.com>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Cc: Steven Rostedt <rostedt@goodmis.org>
>
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Thank you! I will apply on my next rebase.
Thanx, Paul
> -- Steve
>
> > ---
> > arch/Kconfig | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/Kconfig b/arch/Kconfig
> > index c91917b508736..154f994547632 100644
> > --- a/arch/Kconfig
> > +++ b/arch/Kconfig
> > @@ -55,7 +55,7 @@ config KPROBES
> > depends on MODULES
> > depends on HAVE_KPROBES
> > select KALLSYMS
> > - select TASKS_RCU if PREEMPTION
> > + select NEED_TASKS_RCU
> > help
> > Kprobes allows you to trap at almost any kernel address and
> > execute a callback function. register_kprobe() establishes
> > @@ -104,7 +104,7 @@ config STATIC_CALL_SELFTEST
> > config OPTPROBES
> > def_bool y
> > depends on KPROBES && HAVE_OPTPROBES
> > - select TASKS_RCU if PREEMPTION
> > + select NEED_TASKS_RCU
> >
> > config KPROBES_ON_FTRACE
> > def_bool y
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption
2024-02-23 0:26 [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Paul E. McKenney
` (3 preceding siblings ...)
2024-02-23 0:26 ` [PATCH rcu 4/4] tracing: " Paul E. McKenney
@ 2024-02-23 10:54 ` Mark Rutland
4 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2024-02-23 10:54 UTC (permalink / raw)
To: Paul E. McKenney
Cc: rcu, linux-kernel, kernel-team, rostedt, ankur.a.arora, tglx
On Thu, Feb 22, 2024 at 04:26:18PM -0800, Paul E. McKenney wrote:
> Hello!
Hi!
> This series refactors the NEED_TASKS_RCU option so that the conditional
> processing is in one place in kernel/rcu/Kconfig. This makes it easier
> to make sure that Tasks RCU is enabled in PREEMPT_AUTO kernels, given
> that such kernels are preemptible, even if only lazily so. After all,
> it takes only one lazy preemption from a trampoline to significantly
> degrade your kernel's actuarial statistics.
>
> 1. Create NEED_TASKS_RCU to factor out enablement logic.
>
> 2. Select new NEED_TASKS_RCU Kconfig option.
>
> 3. Select new NEED_TASKS_RCU Kconfig option.
>
> 4. Select new NEED_TASKS_RCU Kconfig option.
For the series:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-02-23 10:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 0:26 [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 1/4] rcu: Create NEED_TASKS_RCU to factor out enablement logic Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 2/4] bpf: Select new NEED_TASKS_RCU Kconfig option Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 3/4] arch: " Paul E. McKenney
2024-02-23 1:36 ` Steven Rostedt
2024-02-23 4:57 ` Paul E. McKenney
2024-02-23 0:26 ` [PATCH rcu 4/4] tracing: " Paul E. McKenney
2024-02-23 10:54 ` [PATCH rcu 0/4] Refactor TASKS_RCU for lazy preemption Mark Rutland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox