attach_entity_load_avg(9)
β¨ attach_entity_load_avg β like, the kernel API manual bestie π
okay so real talk, this is attach_entity_load_avg(9) from the Kernel API Manual and honestly it's lowkey one of those tiny functions that carries the whole scheduler on its back. no cap. π«Ά
πΈ NAME πΈ
attach_entity_load_avg β the glow-up moment where this entity gets attached to its cfs_rq load avg. it's giving "you're part of the group now" energy fr fr π
π¦ SYNOPSIS π¦
void attach_entity_load_avg (struct cfs_rq *cfs_rq , struct sched_entity
*se );
that's it. that's the whole signature. two pointers and a void return, main character energy honestly π
π ARGUMENTS π
cfs_rqβ thecfs_rqyou're attaching to. like, the friend group you're joining. πseβ thesched_entitythat's getting attached. that's the new member, that's the one doing the joining. β¨
π DESCRIPTION π
okay so listen, this is the important part and i need you to actually read it, not just skim: you must call update_cfs_rq_load_avg before this, because we literally rely on cfs_rq->avg.last_update_time being current. like, the whole thing falls apart otherwise. π
bestie i'm serious.update_cfs_rq_load_avgFIRST. the function is depending oncfs_rq->avg.last_update_timeactually being up to date, so if you skip the prep step it's not gonna slay, it's gonna be a mess. π
π₯ SEE ALSO π₯
go look at the kernel file ./kernel/sched/fair.c and then go down the whole rabbit hole, because there's a LOT:
update_tg_load_avg(9)update_cfs_rq_load_avg(9)detach_entity_load_avg(9)cpu_util(9)sched_use_asym_prio(9)sched_group_asym(9)update_sg_lb_stats(9)update_sd_pick_busiest(9)idle_cpu_without(9)update_sd_lb_stats(9)calculate_imbalance(9)sched_balance_find_src_group(9)
π§ a lil sign-off π§
this lil page lives under ./kernel/sched and it's dated October 2026, and it's still out here being attach_entity_load_avg(9) in the Kernel API Manual. iconic behavior. obsessed. periodt. π
ππ¦πΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms