kernel/sched/deadline.c
Source file repositories/reference/linux-study-clean/kernel/sched/deadline.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/sched/deadline.c- Extension
.c- Size
- 113480 bytes
- Lines
- 4096
- 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
linux/cpuset.hlinux/sched/clock.hlinux/sched/deadline.huapi/linux/sched/types.hsched.hpelt.h
Detected Declarations
enum dl_bw_requestfunction sched_dl_sysctl_initfunction on_dl_rqfunction is_dl_boostedfunction is_dl_boostedfunction dl_get_typefunction dl_bw_cpusfunction __dl_bw_capacityfunction dl_bw_capacityfunction dl_bw_visitedfunction __dl_updatefunction __dl_subfunction __dl_addfunction __dl_overflowfunction __add_running_bwfunction __sub_running_bwfunction __add_rq_bwfunction __sub_rq_bwfunction add_rq_bwfunction sub_rq_bwfunction add_running_bwfunction sub_running_bwfunction dl_rq_change_utilizationfunction cancel_dl_timerfunction cancel_replenish_timerfunction cancel_inactive_timerfunction dl_change_utilizationfunction task_contendingfunction task_contendingfunction is_leftmostfunction init_dl_bwfunction init_dl_rqfunction dl_overloadedfunction dl_set_overloadfunction dl_clear_overloadfunction __pushable_lessfunction has_pushable_dl_tasksfunction enqueue_pushable_dl_taskfunction dequeue_pushable_dl_taskfunction need_pull_dl_taskfunction deadline_queue_push_tasksfunction deadline_queue_pull_taskfunction replenish_dl_new_periodfunction tofunction Firstfunction dl_time_beforefunction assignedfunction update_dl_revised_wakeup
Annotated Snippet
arch_scale_cpu_capacity(i) == SCHED_CAPACITY_SCALE) {
return dl_bw_cpus(i) << SCHED_CAPACITY_SHIFT;
} else {
RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held(),
"sched RCU must be held");
return __dl_bw_capacity(cpu_rq(i)->rd->span);
}
}
bool dl_bw_visited(int cpu, u64 cookie)
{
struct root_domain *rd = cpu_rq(cpu)->rd;
if (rd->visit_cookie == cookie)
return true;
rd->visit_cookie = cookie;
return false;
}
static inline
void __dl_update(struct dl_bw *dl_b, s64 bw)
{
struct root_domain *rd = container_of(dl_b, struct root_domain, dl_bw);
int i;
RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held(),
"sched RCU must be held");
for_each_cpu_and(i, rd->span, cpu_active_mask) {
struct rq *rq = cpu_rq(i);
rq->dl.extra_bw += bw;
}
}
static inline
void __dl_sub(struct dl_bw *dl_b, u64 tsk_bw, int cpus)
{
dl_b->total_bw -= tsk_bw;
__dl_update(dl_b, (s32)tsk_bw / cpus);
}
static inline
void __dl_add(struct dl_bw *dl_b, u64 tsk_bw, int cpus)
{
dl_b->total_bw += tsk_bw;
__dl_update(dl_b, -((s32)tsk_bw / cpus));
}
static inline bool
__dl_overflow(struct dl_bw *dl_b, unsigned long cap, u64 old_bw, u64 new_bw)
{
return dl_b->bw != -1 &&
cap_scale(dl_b->bw, cap) < dl_b->total_bw - old_bw + new_bw;
}
static inline
void __add_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
{
u64 old = dl_rq->running_bw;
lockdep_assert_rq_held(rq_of_dl_rq(dl_rq));
dl_rq->running_bw += dl_bw;
WARN_ON_ONCE(dl_rq->running_bw < old); /* overflow */
WARN_ON_ONCE(dl_rq->running_bw > dl_rq->this_bw);
/* kick cpufreq (see the comment in kernel/sched/sched.h). */
cpufreq_update_util(rq_of_dl_rq(dl_rq), 0);
}
static inline
void __sub_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
{
u64 old = dl_rq->running_bw;
lockdep_assert_rq_held(rq_of_dl_rq(dl_rq));
dl_rq->running_bw -= dl_bw;
WARN_ON_ONCE(dl_rq->running_bw > old); /* underflow */
if (dl_rq->running_bw > old)
dl_rq->running_bw = 0;
/* kick cpufreq (see the comment in kernel/sched/sched.h). */
cpufreq_update_util(rq_of_dl_rq(dl_rq), 0);
}
static inline
void __add_rq_bw(u64 dl_bw, struct dl_rq *dl_rq)
{
u64 old = dl_rq->this_bw;
lockdep_assert_rq_held(rq_of_dl_rq(dl_rq));
Annotation
- Immediate include surface: `linux/cpuset.h`, `linux/sched/clock.h`, `linux/sched/deadline.h`, `uapi/linux/sched/types.h`, `sched.h`, `pelt.h`.
- Detected declarations: `enum dl_bw_request`, `function sched_dl_sysctl_init`, `function on_dl_rq`, `function is_dl_boosted`, `function is_dl_boosted`, `function dl_get_type`, `function dl_bw_cpus`, `function __dl_bw_capacity`, `function dl_bw_capacity`, `function dl_bw_visited`.
- 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.