include/linux/sched.h
Source file repositories/reference/linux-study-clean/include/linux/sched.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/sched.h- Extension
.h- Size
- 73653 bytes
- Lines
- 2520
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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
uapi/linux/sched.hasm/current.hasm/processor.hlinux/thread_info.hlinux/preempt.hlinux/cpumask_types.hlinux/cache.hlinux/futex_types.hlinux/irqflags_types.hlinux/smp_types.hlinux/pid_types.hlinux/sem_types.hlinux/shm.hlinux/kmsan_types.hlinux/mutex_types.hlinux/plist_types.hlinux/hrtimer_types.hlinux/timer_types.hlinux/seccomp_types.hlinux/nodemask_types.hlinux/refcount_types.hlinux/resource.hlinux/latencytop.hlinux/sched/prio.hlinux/sched/types.hlinux/signal_types.hlinux/spinlock.hlinux/syscall_user_dispatch_types.hlinux/mm_types_task.hlinux/netdevice_xmit.hlinux/task_io_accounting.hlinux/posix-timers_types.h
Detected Declarations
struct audit_contextstruct bio_liststruct blk_plugstruct bpf_local_storagestruct bpf_run_ctxstruct bpf_net_contextstruct capture_controlstruct cfs_rqstruct fs_structstruct io_contextstruct io_uring_taskstruct mempolicystruct nameidatastruct nsproxystruct perf_event_contextstruct perf_ctx_datastruct pid_namespacestruct pipe_inode_infostruct rcu_nodestruct reclaim_statestruct root_domainstruct rqstruct sched_attrstruct sched_dl_entitystruct seq_filestruct sighand_structstruct signal_structstruct task_delay_infostruct task_exec_statestruct task_groupstruct task_structstruct timespec64struct user_event_mmstruct prev_cputimestruct vtimestruct sched_paramstruct sched_infostruct load_weightstruct sched_avgstruct sched_statisticsstruct sched_entitystruct sched_rt_entitystruct rq_flagsstruct sched_dl_entitystruct uclamp_sestruct wake_q_nodestruct kmap_ctrlstruct task_struct
Annotated Snippet
struct prev_cputime {
#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
u64 utime;
u64 stime;
raw_spinlock_t lock;
#endif
};
enum vtime_state {
/* Task is sleeping or running in a CPU with VTIME inactive: */
VTIME_INACTIVE = 0,
/* Task is idle */
VTIME_IDLE,
/* Task runs in kernelspace in a CPU with VTIME active: */
VTIME_SYS,
/* Task runs in userspace in a CPU with VTIME active: */
VTIME_USER,
/* Task runs as guests in a CPU with VTIME active: */
VTIME_GUEST,
};
struct vtime {
seqcount_t seqcount;
unsigned long long starttime;
enum vtime_state state;
unsigned int cpu;
u64 utime;
u64 stime;
u64 gtime;
};
/*
* Utilization clamp constraints.
* @UCLAMP_MIN: Minimum utilization
* @UCLAMP_MAX: Maximum utilization
* @UCLAMP_CNT: Utilization clamp constraints count
*/
enum uclamp_id {
UCLAMP_MIN = 0,
UCLAMP_MAX,
UCLAMP_CNT
};
extern struct root_domain def_root_domain;
extern struct mutex sched_domains_mutex;
extern void sched_domains_mutex_lock(void);
extern void sched_domains_mutex_unlock(void);
struct sched_param {
int sched_priority;
};
struct sched_info {
#ifdef CONFIG_SCHED_INFO
/* Cumulative counters: */
/* # of times we have run on this CPU: */
unsigned long pcount;
/* Time spent waiting on a runqueue: */
unsigned long long run_delay;
/* Max time spent waiting on a runqueue: */
unsigned long long max_run_delay;
/* Min time spent waiting on a runqueue: */
unsigned long long min_run_delay;
/* Timestamps: */
/* When did we last run on a CPU? */
unsigned long long last_arrival;
/* When were we last queued to run? */
unsigned long long last_queued;
/* Timestamp of max time spent waiting on a runqueue: */
struct timespec64 max_run_delay_ts;
#endif /* CONFIG_SCHED_INFO */
};
/*
* Integer metrics need fixed point arithmetic, e.g., sched/fair
* has a few: load, load_avg, util_avg, freq, and capacity.
*
* We define a basic fixed point arithmetic range, and then formalize
* all these metrics based on that basic range.
*/
# define SCHED_FIXEDPOINT_SHIFT 10
Annotation
- Immediate include surface: `uapi/linux/sched.h`, `asm/current.h`, `asm/processor.h`, `linux/thread_info.h`, `linux/preempt.h`, `linux/cpumask_types.h`, `linux/cache.h`, `linux/futex_types.h`.
- Detected declarations: `struct audit_context`, `struct bio_list`, `struct blk_plug`, `struct bpf_local_storage`, `struct bpf_run_ctx`, `struct bpf_net_context`, `struct capture_control`, `struct cfs_rq`, `struct fs_struct`, `struct io_context`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.