Re: [PATCH] qemu-kvm: response to SIGUSR1 to start/stop a VCPU (v2)

Avi Kivity
2010-12-02T09:18:18Z

On 12/01/2010 09:09 PM, Peter Zijlstra wrote:
> >
> > We are dealing with just one task here (the task that is yielding).
> > After recording how much timeslice we are "giving up" in current->donate_time
> > (donate_time is perhaps not the right name to use), we adjust the yielding
> > task's vruntime as per existing logic (for ex: to make it go to back of
> > runqueue). When the yielding tasks gets to run again, lock is hopefully
> > available for it to grab, we let it run longer than the default sched_slice()
> > to compensate for what time it gave up previously to other threads in same
> > runqueue. This ensures that because of yielding upon lock contention, we are not
> > leaking bandwidth in favor of other guests. Again I don't know how much of
> > fairness issue this is in practice, so unless we see some numbers I'd prefer
> > sticking to plain yield() upon lock-contention (for unmodified guests that is).
>
> No, that won't work. Once you've given up time you cannot add it back
> without destroying fairness.
>
> You can limit the unfairness by limiting the amount of feedback, but I
> really dislike such 'yield' semantics.

Agreed.

What I'd like to see in directed yield is donating exactly the amount of
vruntime that's needed to make the target thread run. The donating
thread won't get its vruntime back, unless the other thread hits
contention itself and does a directed yield back. So even if your lock
is ping-ponged around, the guest doesn't lose vruntime compared to other
processes on the host.

--
error compiling committee.c: too many arguments to function