Skip to content

Commit 004d3e1

Browse files
committed
simx86: don't set prejit-via-KVM locks without KVM
According to perf this reduces the total mutex overhead to around 1.1%.
1 parent a177d7e commit 004d3e1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/base/emu-i386/simx86/cpu-emu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,10 @@ static int lockcnt;
15901590
void prejit_lock(void)
15911591
{
15921592
prejit_sync();
1593+
#if !PREJIT_TEST
1594+
if (config.cpu_vm != CPUVM_KVM && config.cpu_vm_dpmi != CPUVM_KVM)
1595+
return;
1596+
#endif
15931597
/* No actual locking: just wait til prejit stops. */
15941598
pthread_mutex_lock(&run_mtx);
15951599
lockcnt++;
@@ -1600,6 +1604,10 @@ void prejit_lock(void)
16001604

16011605
void prejit_unlock(void)
16021606
{
1607+
#if !PREJIT_TEST
1608+
if (config.cpu_vm != CPUVM_KVM && config.cpu_vm_dpmi != CPUVM_KVM)
1609+
return;
1610+
#endif
16031611
pthread_mutex_lock(&run_mtx);
16041612
assert(lockcnt > 0);
16051613
lockcnt--;

0 commit comments

Comments
 (0)