]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 27 Nov 2025 15:36:51 +0000 (16:36 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 27 Nov 2025 15:55:34 +0000 (16:55 +0100)
The pool of free objects is refilled on several occasions such as object
initialisation. On PREEMPT_RT refilling is limited to preemptible
sections due to sleeping locks used by the memory allocator. The system
boots with disabled interrupts so the pool can not be refilled.

If too many objects are initialized and the pool gets empty then
debugobjects disables itself.

Refiling can also happen early in the boot with disabled interrupts as
long as the scheduler is not operational. If the scheduler can not
preempt a task then a sleeping lock can not be contended.

Allow to additionally refill the pool if the scheduler is not
operational.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/20251127153652.291697-2-bigeasy@linutronix.de
lib/debugobjects.c

index 7f50c4480a4e383a23f435f193a7502190f6c332..7017e5c8f32ddd3c884b8b1cac4400f77281c788 100644 (file)
@@ -714,7 +714,7 @@ static void debug_objects_fill_pool(void)
         * raw_spinlock_t are basically the same type and this lock-type
         * inversion works just fine.
         */
-       if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible()) {
+       if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible() || system_state < SYSTEM_SCHEDULING) {
                /*
                 * Annotate away the spinlock_t inside raw_spinlock_t warning
                 * by temporarily raising the wait-type to WAIT_SLEEP, matching