Check 'td_owepreempt' and yield the vcpu thread if it is set.

This is done explicitly because a vcpu thread can be in a critical section
for the entire time slice alloted to it. This in turn can delay the handling
of the 'td_owepreempt'.

Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D2430
This commit is contained in:
neel 2015-05-06 23:40:24 +00:00
parent 14fd588310
commit 390ea95709

View File

@ -276,7 +276,13 @@ vcpu_is_running(struct vm *vm, int vcpu, int *hostcpu)
static int __inline
vcpu_should_yield(struct vm *vm, int vcpu)
{
return (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED));
if (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED))
return (1);
else if (curthread->td_owepreempt)
return (1);
else
return (0);
}
#endif