diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2013-08-22 13:56:52 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2013-08-22 13:56:52 +0000 |
commit | c840e9f1a63d576ec1d02b0c6ac9ddddf1750aca (patch) | |
tree | 60883758aa927fe86e279d293b20a0f2b8826847 /src/VBox/VMM/VMMAll/VMMAll.cpp | |
parent | afc92889ec128684f905cd4c5169fe65cb7a2afc (diff) | |
download | VirtualBox-svn-c840e9f1a63d576ec1d02b0c6ac9ddddf1750aca.tar.gz |
VMM/VMMR0: Preemption hooks implemented and enabled for Solaris and Linux hosts.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@47989 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/VMM/VMMAll/VMMAll.cpp')
-rw-r--r-- | src/VBox/VMM/VMMAll/VMMAll.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/VBox/VMM/VMMAll/VMMAll.cpp b/src/VBox/VMM/VMMAll/VMMAll.cpp index a891b7251c5..8a883796102 100644 --- a/src/VBox/VMM/VMMAll/VMMAll.cpp +++ b/src/VBox/VMM/VMMAll/VMMAll.cpp @@ -252,20 +252,27 @@ VMMDECL(PVMCPU) VMMGetCpu(PVM pVM) if (pVM->cCpus == 1) return &pVM->aCpus[0]; - /* Search first by host cpu id (most common case) + /* + * Search first by host cpu id (most common case) * and then by native thread id (page fusion case). */ + if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD)) + { + /** @todo r=ramshankar: This doesn't buy us anything in terms of performance + * leaving it here for hysterical raisins and as a reference if we + * implemented a hashing approach in the future. */ - /* RTMpCpuId had better be cheap. */ - RTCPUID idHostCpu = RTMpCpuId(); + /* RTMpCpuId had better be cheap. */ + RTCPUID idHostCpu = RTMpCpuId(); - /** @todo optimize for large number of VCPUs when that becomes more common. */ - for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) - { - PVMCPU pVCpu = &pVM->aCpus[idCpu]; + /** @todo optimize for large number of VCPUs when that becomes more common. */ + for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) + { + PVMCPU pVCpu = &pVM->aCpus[idCpu]; - if (pVCpu->idHostCpu == idHostCpu) - return pVCpu; + if (pVCpu->idHostCpu == idHostCpu) + return pVCpu; + } } /* RTThreadGetNativeSelf had better be cheap. */ |