Re: [PATCH 3/3] sched/preempt: Check preempt counts in notrace helpers

From: Steven Rostedt

Date: Tue Nov 24 2026 - 11:08:49 EST


On Mon, 16 Nov 2026 08:54:24 +0100
Karl Mehltretter <kmehltretter@xxxxxxxxx> wrote:

> --- a/kernel/sched/Makefile
> +++ b/kernel/sched/Makefile
> @@ -27,6 +27,9 @@ endif
>
> # Branch profiling isn't noinstr-safe
> ifdef CONFIG_TRACE_BRANCH_PROFILING
> +ifdef CONFIG_DEBUG_PREEMPT
> +CFLAGS_core.o += -DDISABLE_BRANCH_PROFILING
> +endif
> CFLAGS_build_policy.o += -DDISABLE_BRANCH_PROFILING
> CFLAGS_build_utility.o += -DDISABLE_BRANCH_PROFILING

Branch profiling is really for checking production code and not debug code.
I don't see a use case to see what branches are taken when the kernel is in
debug mode.

I think it would be better to just have BRANCH_PROFILING depend on
!DEBUG_PREEMPT. Then the above wouldn't even be possible.

Thanks,

-- Steve


> endif
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 1a088d4576f59..98ca93bc60887 100644