Skip to contentSkip to conversation

sched_ext: Fix SCX_EFLAG_INITIALIZED being a no-op flag

PATCH Applied David Carlier 2 participants 2 messages Feb 26 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched_ext: Fix SCX_EFLAG_INITIALIZED being a no-op flag

SCX_EFLAG_INITIALIZED is the sole member of enum scx_exit_flags with no explicit value, so the compiler assigns it 0. This makes the bitwise OR in scx_ops_init() a no-op:

    sch->exit_info->flags |= SCX_EFLAG_INITIALIZED; /* |= 0 */

As a result, BPF schedulers cannot distinguish whether ops.init() completed successfully by inspecting exit_info->flags.

Assign the value 1LLU << 0 so the flag is actually set.

---
 kernel/sched/ext_internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/ext_internal.h +1 -1
index 386c677e4c9a..11ebb744d893 100644
@@ -74,7 +74,7 @@ enum scx_exit_flags {
 	 * info communication. The following flag indicates whether ops.init()
 	 * finished successfully.
 	 */
-	SCX_EFLAG_INITIALIZED,
+	SCX_EFLAG_INITIALIZED   = 1LLU << 0,
 };
 
 /*
Signature · 1 line
2.51.0
Applied
#1 lore raw

Hello,

Applied to sched_ext/for-7.0-fixes with Fixes tag added.

Thanks.

--
tejun