svn commit: r282571 - head/sys/amd64/include

Neel Natu neel at FreeBSD.org
Wed May 6 23:40:25 UTC 2015


Author: neel
Date: Wed May  6 23:40:24 2015
New Revision: 282571
URL: https://svnweb.freebsd.org/changeset/base/282571

Log:
  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

Modified:
  head/sys/amd64/include/vmm.h

Modified: head/sys/amd64/include/vmm.h
==============================================================================
--- head/sys/amd64/include/vmm.h	Wed May  6 23:26:51 2015	(r282570)
+++ head/sys/amd64/include/vmm.h	Wed May  6 23:40:24 2015	(r282571)
@@ -276,7 +276,13 @@ vcpu_is_running(struct vm *vm, int vcpu,
 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
 


More information about the svn-src-all mailing list