Re: [PATCH] debugobjects: Don't call fill_pool() in early boot non-task context of RT kernel

From: Waiman Long

Date: Wed May 20 2026 - 15:06:36 EST


On 5/20/26 2:04 PM, Thomas Gleixner wrote:
On Wed, May 20 2026 at 12:57, Waiman Long wrote:
On 5/20/26 12:43 PM, Waiman Long wrote:
It shouldn't really be a problem as fill_poll() will not called from
non-preemptible context after early boot, but the lockdep warning can
still cause confusion and anxiety. Fix that by further restricting the
call to only in_task() context during early boot.
Sorry, the above paragraph isn't right. Will send out a v2.
And please trim the back trace while at it.
OK, will send a v3.

Fixes: 06e0ae988f6e ("debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING")
Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
---
lib/debugobjects.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 12e2e42e6a31..236ea5e716df 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -727,11 +727,14 @@ static void debug_objects_fill_pool(void)
/*
* On RT enabled kernels the pool refill must happen in preemptible
- * context -- for !RT kernels we rely on the fact that spinlock_t and
+ * context or in task context during early boot.
+ *
+ * For !RT kernels we rely on the fact that spinlock_t and
* raw_spinlock_t are basically the same type and this lock-type
* inversion works just fine.
*/
- if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible() || system_state < SYSTEM_SCHEDULING) {
+ if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible() ||
+ (system_state < SYSTEM_SCHEDULING && in_task())) {
Conflicts with:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=core/urgent

Will rebase it to tip.

Thanks,
Longman