Re: [PATCH RFC 2/4] Add yield hypercall for KVM guests
From: Avi Kivity
Date: Mon Aug 02 2010 - 04:40:42 EST
On 07/28/2010 05:55 PM, Srivatsa Vaddagiri wrote:
On Mon, Jul 26, 2010 at 10:19:41AM -0700, Jeremy Fitzhardinge wrote:
On 07/25/2010 11:14 PM, Srivatsa Vaddagiri wrote:
We don't have that support yet in Linux scheduler.
Add KVM hypercall for yielding vcpu timeslice.
Can you do a directed yield?
If you think it's useful, it would be good to design it into the
interface, and fall back to ordinary yield if the host doesn't support it.
A big advantage of directed yield vs yield is that you conserve
resources within a VM; a simple yield will cause the guest to drop its
share of cpu to other guest.
Made up example:
- 2 vcpu guest with 10% contention
- lock hold time 10us every 100us
- timeslice 1ms
Ideally this guest can consume 190% cpu (sleeping whenever there is
contention). But if we yield when we detect contention, then we sleep
for 1ms, and utilization drops to around 100%-150% (a vcpu will usually
fall asleep soon within a few 100us periods).
Also I feel it would be more
useful when the target vcpu and yielding vcpu are on the same physical cpu,
rather than when they are on separate cpus. With latter, yielding (or
donating) timeslice need not ensure that target vcpu runs immediately
Donate at least the amount needed to wake up the other vcpu, we can
calculate it during wakeup.
and also I suspect fairness issues needs to be tackled as well (large number of
waiters shouldn't boot a lock-holders time slice too much that it gets a
I feel ordinary yield suffers from fairness a lot more.
error compiling committee.c: too many arguments to function
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/