Re: [POC][RFC][PATCH v2] sched: Extended Scheduler Time Slice

From: Steven Rostedt
Date: Mon Oct 30 2023 - 14:39:13 EST


On Mon, 30 Oct 2023 14:27:10 -0400
Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote:

> > So I just made every unlock disable the extended time slot. I need to go
> > back and enable both a counter and an on/off as I now realize that the spin
> > locks (called within the lwlock) will disable the extend time before the
> > lwlock is released. This should work if I have the spinlocks inc and dec
> > (they are straight forward and all locks are associated with an easily
> > found unlock), and have the lwlock use bit 31 as an on/off switch.
>
> This extra on/off switch appears to be working around userspace issues.

Yep!

But that doesn't mean there's not a legitimate use case for it. I don't
want to limit the feature for that. It's unlikely bit 31 would ever be hit
by a counter anyway, for which it could be used as an on/off switch the
same way the NEED_RESCHED bit is used as an on/off switch for preempt_count
in the kernel.

>
> > Anyway, I would let user space decide what it wants to do, and giving it 31
> > bits to say "I'm extended" and let user space come up with how it handles
> > those 31 bits.
>
> If this makes it into the RSEQ uapi, RSEQ should state how userspace
> should collaborate wrt those bits (e.g. nesting counter protocol), even
> though it's not a kernel ABI per se. Otherwise we'll just push this to
> libc to specify this, which is odd.

I agree that user space should have the usage specified. Hell, that bit
could just be used for testing purposes. I think having it reserved is a
good thing than not specifying it and limiting its usage later.

-- Steve