mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
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>
This commit is contained in:
parent
c7e739746d
commit
f3aec2adce
|
|
@ -4554,6 +4554,7 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link)
|
||||||
scx_error(sch, "ops.init() failed (%d)", ret);
|
scx_error(sch, "ops.init() failed (%d)", ret);
|
||||||
goto err_disable;
|
goto err_disable;
|
||||||
}
|
}
|
||||||
|
sch->exit_info->flags |= SCX_EFLAG_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = SCX_OPI_CPU_HOTPLUG_BEGIN; i < SCX_OPI_CPU_HOTPLUG_END; i++)
|
for (i = SCX_OPI_CPU_HOTPLUG_BEGIN; i < SCX_OPI_CPU_HOTPLUG_END; i++)
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,16 @@ enum scx_exit_code {
|
||||||
SCX_ECODE_ACT_RESTART = 1LLU << 48,
|
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
|
* scx_exit_info is passed to ops.exit() to describe why the BPF scheduler is
|
||||||
* being disabled.
|
* being disabled.
|
||||||
|
|
@ -73,6 +83,9 @@ struct scx_exit_info {
|
||||||
/* exit code if gracefully exiting */
|
/* exit code if gracefully exiting */
|
||||||
s64 exit_code;
|
s64 exit_code;
|
||||||
|
|
||||||
|
/* %SCX_EFLAG_* */
|
||||||
|
u64 flags;
|
||||||
|
|
||||||
/* textual representation of the above */
|
/* textual representation of the above */
|
||||||
const char *reason;
|
const char *reason;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user