Messages in this thread | | | Date | Tue, 04 Mar 2014 14:39:48 -0700 | From | Khalid Aziz <> | Subject | Re: [RFC] [PATCH] Pre-emption control for userspace |
| |
On 03/04/2014 02:12 PM, H. Peter Anvin wrote: > > Shades of the Android wakelocks, no? > > This seems to effectively give userspace an option to turn preemptive > multitasking into cooperative multitasking, which of course is > unacceptable for a privileged process (the same reason why unprivileged > processes aren't allowed to run at above-normal priority, including RT > priority.) > > I have several issues with this interface: > > 1. First, a process needs to know if it *should* have been preempted > before it calls sched_yield(). So there needs to be a second flag set > by the scheduler when granting amnesty.
Good idea. I like it. I will add it.
> > 2. A process which fails to call sched_yield() after being granted > amnesty must be penalized.
I agree. Is it fair to say that such a process sees the penalty by being charged that extra timeslice and being pushed to the right side of RB tree since its p->se.vruntime would have gone up, which then delays the time when it can get CPU again? I am open to adding a more explicit penalty - maybe deny its next preemption delay request if it failed to call sched_yield() the last time when it should have?
> > 3. I'm not keen on occupying a full page for this. I'm wondering if > doing a pointer into user space, futex-style, might make more sense. > The downside, of course, is what happens if the page being pointed to is > swapped out.
Using a full page for what is effectively a single bit flag does not sit well with me either. Doing it through proc forces minimum size of a page (please correct me there if I am wrong). I will explore your idea some more to see if that can be made to work.
> > Keep in mind this HAS to be per thread. >
Thanks, hpa!
-- Khalid
| |