htb_do_events(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… htb_do_events(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual β€” today's main character is htb_do_events(9), and honestly? she's the one quietly keeping the whole HTB class-level situation from falling apart. let's get into it πŸŽ€


✨ NAME ✨

htb_do_events β€” makes mode changes to classes at the level. yeah. that's the whole vibe. she shows up, she flips modes, she leaves. iconic behavior only πŸ’…


🌸 SYNOPSIS 🌸

s64 htb_do_events (struct htb_sched *q , const int level , unsigned long
start );

like, look at that signature. s64 return, three args, zero drama (okay maybe a lil drama, see NOTE below 😭). periodt.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • q β€” the priority event queue πŸ’– this is the whole reason we're here.
  • level β€” tells you which wait_pq lives inside q->hlevel. yes, the specific one. don't @ me.
  • start β€” the start jiffies ⏱️ the clock we're measuring from, bestie.

πŸ’€ DESCRIPTION πŸ’€

so what does she actually do? she scans the event queue for pending events and applies them. that's it. that's the job. no cap 🫢

and then β€” because she's thoughtful like that β€” she returns the time of the next pending event. but read the fine print bestie, because the return value is giving three different moods:

  • 0 when there's no event in the pq
  • q->now when there are too many events 😭 (yes, too many. she said enough.)

lowkey the most emotionally complex return value in sch_htb.c. ngl.


⭐ NOTE ⭐

applied are the events whose cl->pq_key <= q->now. that's the vibe check they have to pass to get processed. if you're not at or before now, you're not getting applied. sorry babe πŸŽ€


🌈 SEE ALSO 🌈

the kernel file ./net/sched/sch_htb.c and her whole friend group, fr fr:

every single one of them. iykyk πŸ’œ


and that's the page!! sourced straight from ./net/sched, dated October 2026 β€” write it down bestie, that's the receipt 🧚✨ bye ily 🫢

πŸ“¦ where this page comes from