[PATCH 5/5] ntoskrnl: Use YieldProcessor().
Zebediah Figura
z.figura12 at gmail.com
Wed Jan 20 22:35:49 CST 2021
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
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) );
--
2.29.2
More information about the wine-devel
mailing list