summaryrefslogtreecommitdiff
path: root/kernel/sched/ext_internal.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2025-09-23 09:03:26 -1000
committerTejun Heo <tj@kernel.org>2025-09-23 09:03:26 -1000
commitf3aec2adce8dbe37dabff47a16bfb260b987e0b0 (patch)
tree3a8d9a13b4c295614a7685d679651eb6cd41e34e /kernel/sched/ext_internal.h
parentc7e739746dbde9ae401fd88824f5656c5e2361fc (diff)
sched_ext: Add SCX_EFLAG_INITIALIZED to indicate successful ops.init()
ops.exit() may be called even if the loading failed before ops.init() finishes successfully. This is because ops.exit() allows rich exit info communication. Add SCX_EFLAG_INITIALIZED flag to scx_exit_info.flags to indicate whether ops.init() finished successfully. This enables BPF schedulers to distinguish between exit scenarios and handle cleanup appropriately based on initialization state. Acked-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/sched/ext_internal.h')
-rw-r--r--kernel/sched/ext_internal.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/sched/ext_internal.h b/kernel/sched/ext_internal.h
index 1a80d01b1f0c..b3617abed510 100644
--- a/kernel/sched/ext_internal.h
+++ b/kernel/sched/ext_internal.h
@@ -62,6 +62,16 @@ enum scx_exit_code {
SCX_ECODE_ACT_RESTART = 1LLU << 48,
};
+enum scx_exit_flags {
+ /*
+ * ops.exit() may be called even if the loading failed before ops.init()
+ * finishes successfully. This is because ops.exit() allows rich exit
+ * info communication. The following flag indicates whether ops.init()
+ * finished successfully.
+ */
+ SCX_EFLAG_INITIALIZED,
+};
+
/*
* scx_exit_info is passed to ops.exit() to describe why the BPF scheduler is
* being disabled.
@@ -73,6 +83,9 @@ struct scx_exit_info {
/* exit code if gracefully exiting */
s64 exit_code;
+ /* %SCX_EFLAG_* */
+ u64 flags;
+
/* textual representation of the above */
const char *reason;