kernel/sched/ext_internal.h
Source file repositories/reference/linux-study-clean/kernel/sched/ext_internal.h
File Facts
- System
- Linux kernel
- Corpus path
kernel/sched/ext_internal.h- Extension
.h- Size
- 54588 bytes
- Lines
- 1654
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct scx_exit_infostruct scx_init_task_argsstruct scx_exit_task_argsstruct scx_cgroup_init_argsstruct scx_cpu_acquire_argsstruct scx_cpu_release_argsstruct scx_dump_ctxstruct scx_sub_attach_argsstruct scx_sub_detach_argsstruct sched_ext_opsstruct sched_ext_ops_cidstruct scx_event_statsstruct scx_schedstruct scx_dsp_buf_entstruct scx_dsp_ctxstruct scx_deferred_reenq_localstruct scx_sched_pcpustruct scx_sched_pnodestruct scx_schedenum scx_exit_kindenum scx_exit_codeenum scx_exit_flagsenum scx_ops_flagsenum scx_cpu_preempt_reasonenum scx_opienum scx_sched_pcpu_flagsenum scx_wake_flagsenum scx_enq_flagsenum scx_deq_flagsenum scx_reenq_flagsenum scx_pick_idle_cpu_flagsenum scx_kick_flagsenum scx_tg_flagsenum scx_enable_stateenum scx_ops_statefunction Thefunction scx_bypassingfunction scx_task_on_schedfunction scx_task_on_sched
Annotated Snippet
struct scx_exit_info {
/* %SCX_EXIT_* - broad category of the exit reason */
enum scx_exit_kind kind;
/*
* CPU that initiated the exit, valid once @kind has been set.
* Negative if the exit path didn't identify a CPU.
*/
s32 exit_cpu;
/* exit code if gracefully exiting */
s64 exit_code;
/* %SCX_EFLAG_* */
u64 flags;
/* textual representation of the above */
const char *reason;
/* backtrace if exiting due to an error */
unsigned long *bt;
u32 bt_len;
/* informational message */
char *msg;
/* debug dump */
char *dump;
};
/* sched_ext_ops.flags */
enum scx_ops_flags {
/*
* Keep built-in idle tracking even if ops.update_idle() is implemented.
*/
SCX_OPS_KEEP_BUILTIN_IDLE = 1LLU << 0,
/*
* By default, if there are no other task to run on the CPU, ext core
* keeps running the current task even after its slice expires. If this
* flag is specified, such tasks are passed to ops.enqueue() with
* %SCX_ENQ_LAST. See the comment above %SCX_ENQ_LAST for more info.
*/
SCX_OPS_ENQ_LAST = 1LLU << 1,
/*
* An exiting task may schedule after PF_EXITING is set. In such cases,
* bpf_task_from_pid() may not be able to find the task and if the BPF
* scheduler depends on pid lookup for dispatching, the task will be
* lost leading to various issues including RCU grace period stalls.
*
* To mask this problem, by default, unhashed tasks are automatically
* dispatched to the local DSQ on enqueue. If the BPF scheduler doesn't
* depend on pid lookups and wants to handle these tasks directly, the
* following flag can be used. With %SCX_OPS_TID_TO_TASK,
* scx_bpf_tid_to_task() can find exiting tasks reliably.
*/
SCX_OPS_ENQ_EXITING = 1LLU << 2,
/*
* If set, only tasks with policy set to SCHED_EXT are attached to
* sched_ext. If clear, SCHED_NORMAL tasks are also included.
*/
SCX_OPS_SWITCH_PARTIAL = 1LLU << 3,
/*
* A migration disabled task can only execute on its current CPU. By
* default, such tasks are automatically put on the CPU's local DSQ with
* the default slice on enqueue. If this ops flag is set, they also go
* through ops.enqueue().
*
* A migration disabled task never invokes ops.select_cpu() as it can
* only select the current CPU. Also, p->cpus_ptr will only contain its
* current CPU while p->nr_cpus_allowed keeps tracking p->user_cpus_ptr
* and thus may disagree with cpumask_weight(p->cpus_ptr).
*/
SCX_OPS_ENQ_MIGRATION_DISABLED = 1LLU << 4,
/*
* Queued wakeup (ttwu_queue) is a wakeup optimization that invokes
* ops.enqueue() on the ops.select_cpu() selected or the wakee's
* previous CPU via IPI (inter-processor interrupt) to reduce cacheline
* transfers. When this optimization is enabled, ops.select_cpu() is
* skipped in some cases (when racing against the wakee switching out).
* As the BPF scheduler may depend on ops.select_cpu() being invoked
* during wakeups, queued wakeup is disabled by default.
*
* If this ops flag is set, queued wakeup optimization is enabled and
* the BPF scheduler must be able to handle ops.enqueue() invoked on the
* wakee's CPU without preceding ops.select_cpu() even for tasks which
Annotation
- Detected declarations: `struct scx_exit_info`, `struct scx_init_task_args`, `struct scx_exit_task_args`, `struct scx_cgroup_init_args`, `struct scx_cpu_acquire_args`, `struct scx_cpu_release_args`, `struct scx_dump_ctx`, `struct scx_sub_attach_args`, `struct scx_sub_detach_args`, `struct sched_ext_ops`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.