Use sched_wakeup instead of sched_add when marking an ithread
runnable. This allows schedulers to reset their internal time slice
tracking state and restore the base ithread priority when an ithread
resumes from idle.
Sponsored by: Netflix
Differential D35643 Authored by jhb on Jun 28 2022, 10:31 PM.
Details
Summary Use sched_wakeup instead of sched_add when marking an ithread Sponsored by: Netflix
Diff Detail
Event TimelineHerald added a subscriber: imp. · View Herald TranscriptJun 28 2022, 10:31 PM2022-06-28 22:31:49 (UTC+0) Harbormaster completed remote builds in B46166: Diff 107505.Jun 28 2022, 10:31 PM2022-06-28 22:31:49 (UTC+0) Comment Actions So this change would be not needed if you do the prio adjustments in sched_add(). I think more explanations are needed if there is a reason to handle ithreads prio in sched_wakeup(). Is it just a micro-optimization to avoid one more if() in sched_add()? Comment Actions One more if that would end up duplicating logic. However, it's also true that you don't want to do it on every sched_add(). For example, if an ithread is preempted the old thread gets put on the runqueues via sched_add() and you don't want that step to reset the scheduler's internal notion of CPU usage (how much of a time slice has been used). You only want to reset the usage back to zero when the ithread goes idle. In practice though it is simpler to mimic what happens now for other threads which is to reset it not when going idle, but when resumed from being idle. This is how it works today for other threads that only reset their time slice usage when resumed from sleeping, not every time they are put on a run queue. This revision is now accepted and ready to land.Jul 12 2022, 1:31 PM2022-07-12 13:31:06 (UTC+0) Closed by commit rGed998d1c24db: ithreads: Support priority adjustment by schedulers. (authored by jhb). · Explain WhyJul 14 2022, 8:15 PM2022-07-14 20:15:58 (UTC+0) This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 107505 sys/kern/kern_intr.c
sys/kern/kern_timeout.c
|
I would be interested in implementing this, but not sure how soon that would be...