From: Julian Seward Date: Wed, 24 May 2017 13:42:33 +0000 (+0000) Subject: When a thread hints that it is in a spin-wait loop (eg, x86 REP NOP insn), X-Git-Tag: svn/VALGRIND_3_13_0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a06d64ce514d188f01455c1d2d9cbd7996c7c79;p=thirdparty%2Fvalgrind.git When a thread hints that it is in a spin-wait loop (eg, x86 REP NOP insn), deschedule the thread much sooner (300 evchecks) than previously (1000 evchecks). Once the thread is spinning, there's absolutely no point in continuing with it, since only a different thread can get it out of the loop, so we need to drop the current thread ASAP. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16412 --- diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 7bc03f9aad..39f10f8882 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -1453,8 +1453,8 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid ) before swapping to another. That means that short term spins waiting for hardware to poke memory won't cause a thread swap. */ - if (dispatch_ctr > 1000) - dispatch_ctr = 1000; + if (dispatch_ctr > 300) + dispatch_ctr = 300; break; case VG_TRC_INNER_COUNTERZERO: