Ok, I like this. That said, this part of it: On Wed, 20 Sept 2023 at 16:58, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote: > > -void resched_curr(struct rq *rq) > +static void __resched_curr(struct rq *rq, int nr_bit) > [...] > - set_tsk_need_resched(curr); > - set_preempt_need_resched(); > + set_tsk_thread_flag(curr, nr_bit); > + if (nr_bit == TIF_NEED_RESCHED) > + set_preempt_need_resched(); feels really hacky. I think that instead of passing a random TIF bit around, it should just pass a "lazy or not" value around. Then you make the TIF bit be some easily computable thing (eg something like #define TIF_RESCHED(lazy) (TIF_NEED_RESCHED + (lazy)) or whatever), and write the above conditional as if (!lazy) set_preempt_need_resched(); so that it all *does* the same thing, but the code makes it clear about what the logic is. Because honestly, without having been part of this thread, I would look at that if (nr_bit == TIF_NEED_RESCHED) set_preempt_need_resched(); and I'd be completely lost. It doesn't make conceptual sense, I feel. So I'd really like the source code to be more directly expressing the *intent* of the code, not be so centered around the implementation detail. Put another way: I think we can make the compiler turn the intent into the implementation, and I'd rather *not* have us humans have to infer the intent from the implementation. That said - I think as a proof of concept and "look, with this we get the expected scheduling event counts", that patch is perfect. I think you more than proved the concept. Linus