update_tg_load_avg(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– update_tg_load_avg(9) πŸ’–

okay so bestie, we're deep in the Kernel API Manual today β€” yes, the actual kernel, yes, the scheduler, don't panic, I got you 🫢 this one is a little CFS scheduling function and it's honestly not that deep once you see what it's doing. let's go ✨


🌸 NAME 🌸

update_tg_load_avg β€” update the tg's load avg. that's it, that's the whole name, and honestly it ate πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

void update_tg_load_avg (struct cfs_rq *cfs_rq );

it returns void, so like... don't go looking for a return value, there isn't one, she gives nothing back, she just does πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • cfs_rq β€” the cfs_rq whose avg changed. that's the one you're handing over, the one that moved, the main character of this call 🌟

✨ DESCRIPTION ✨

so this function 'ensures' β€” and yes the manpage itself put 'ensures' in quotes like that, iconic of it β€” that:

tg->load_avg :=  tg->cfs_rq[]->avg.load

but here's the plot twist 😭 because tg->load_avg is a global value, there are performance considerations. like, real ones. the vibe check says: don't be out here doing expensive things in a hot path, bestie.

so how do we dodge that? in order to avoid having to look at the other cfs_rq's, we use a differential update where we store the last value we propagated πŸ‘‘ that's the whole trick.

and this in turn allows skipping updates if the differential is 'small' β€” again with the quotes, and again, that's literally what the page says, I'm not making this up πŸ™ˆ so yeah, small diff = we can skip, and that's a slay for your CPU cycles fr fr.

⭐ key thing to remember: updating tg's load_avg is necessary before update_cfs_group. not optional, not "if you feel like it", it's a prerequisite. do it first, periodt.

🌈 SEE ALSO 🌈


and that's the whole page bestie, you're officially caught up on load average propagation πŸ§šπŸ’œ this came to you from the ./kernel/sched directory, and the page is dated October 2026 β€” so yeah, future-coded of it, we love a timestamp with range 🌸 bye, go read update_cfs_group next, mwah πŸ˜­πŸ’–

πŸ“¦ where this page comes from