lkml.org 
[lkml]   [2014]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] [PATCH] Pre-emption control for userspace
On Thu, Mar 06, 2014 at 11:13:33PM +1100, Kevin Easton wrote:
> On Tue, Mar 04, 2014 at 04:51:15PM -0800, Andi Kleen wrote:
> > Anything else?
>
> If it was possible to make the time remaining in the current timeslice
> available to userspace through the vdso, the thread could do something like:

Assuming we can do per-cpu values in the VDSO; this would mean hitting
that cacheline on every context switch and wakeup. That's a complete
non-starter performance wise.

>
> if (sys_timeleft() < CRITICAL_SECTION_SIZE)
> yield();
> lock();
>
> to avoid running out of timeslice in the middle of the critical section.

Can still happen, the effective slice of a single runnable task is
infinite, the moment another task gets woken this gets reduced to a finite
amount, we then keep reducing the slice until there are about 8 runnable
tasks (assuming you've not poked at any sysctls).

Also; depending on the state of the just woken task; it might land left
of you in the tree, making it immediately eligible to run, completely
obviating whatever number you just read.




\
 
 \ /
  Last update: 2014-03-06 15:41    [W:0.591 / U:1.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site