Zebediah Figura : ntoskrnl: Use YieldProcessor().

Alexandre Julliard julliard at winehq.org
Thu Jan 21 16:19:14 CST 2021


Module: wine
Branch: master
Commit: c0ce83371b1c45d22d584afc7407cfcf9d4063aa
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c0ce83371b1c45d22d584afc7407cfcf9d4063aa

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Jan 20 22:35:49 2021 -0600

ntoskrnl: Use YieldProcessor().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntoskrnl.exe/sync.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c
index 671398594e8..2aa60a0f2a0 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -540,15 +540,6 @@ void WINAPI KeInitializeSpinLock( KSPIN_LOCK *lock )
     *lock = 0;
 }
 
-static inline void small_pause(void)
-{
-#ifdef __x86_64__
-    __asm__ __volatile__( "rep;nop" : : : "memory" );
-#else
-    __asm__ __volatile__( "" : : : "memory" );
-#endif
-}
-
 /***********************************************************************
  *           KeAcquireSpinLockAtDpcLevel (NTOSKRNL.EXE.@)
  */
@@ -556,7 +547,7 @@ void WINAPI KeAcquireSpinLockAtDpcLevel( KSPIN_LOCK *lock )
 {
     TRACE("lock %p.\n", lock);
     while (InterlockedCompareExchangePointer( (void **)lock, (void *)1, (void *)0 ))
-        small_pause();
+        YieldProcessor();
 }
 
 /***********************************************************************
@@ -592,7 +583,7 @@ void FASTCALL KeAcquireInStackQueuedSpinLockAtDpcLevel( KSPIN_LOCK *lock, KLOCK_
         while (!((ULONG_PTR)InterlockedCompareExchangePointer( (void **)&queue->LockQueue.Lock, 0, 0 )
                  & QUEUED_SPINLOCK_OWNED))
         {
-            small_pause();
+            YieldProcessor();
         }
     }
 }
@@ -619,7 +610,7 @@ void FASTCALL KeReleaseInStackQueuedSpinLockFromDpcLevel( KLOCK_QUEUE_HANDLE *qu
         /* Otherwise, someone just queued themselves, but hasn't yet set
          * themselves as successor. Spin waiting for them to do so. */
         while (!(next = queue->LockQueue.Next))
-            small_pause();
+            YieldProcessor();
     }
 
     InterlockedExchangePointer( (void **)&next->Lock, (KSPIN_LOCK *)((ULONG_PTR)lock | QUEUED_SPINLOCK_OWNED) );




More information about the wine-cvs mailing list