Manual tests on Windows 10 show that calling Sleep(0) or NtDelayExecution() with zero timeout in a loop do consume 100% of a CPU core, which is closer to the behavior of NtYieldExecution() than usleep(0). usleep(0) gives up the remaining timeslices even if there are no other threads to switch to, causing low utilization of CPU and performance issues.
The original patch is b1a79c6 and the idea is to use usleep(0) to avoid a thread taking 100% of a CPU core for StarCraft 2 and Shadow of the Tomb Raider. However with wine-7.22, reverting the usleep(0) patch causes no behavior changes. For Shadow of the Tomb Raider, the 100% CPU issue is gone with or without the patch. For StarCraft 2, there is always a thread taking 100% CPU even with the patch. After discussing with Matteo, we decided it's better to revert the patch.
Fix Mortal Kombat X performance drop during tower selection and Ragnarok Online bad performance.
This reverts commit e86b4015ff405d4c054b8a5bc855ee655e1a833c.
From: Zhiyi Zhang zzhang@codeweavers.com
Manual tests on Windows 10 show that calling Sleep(0) or NtDelayExecution() with zero timeout in a loop do consume 100% of a CPU core, which is closer to the behavior of NtYieldExecution() than usleep(0). usleep(0) gives up the remaining timeslices even if there are no other threads to switch to, causing low utilization of CPU and performance issues.
The original patch is b1a79c6 and the idea is to use usleep(0) to avoid a thread taking 100% of a CPU core for StarCraft 2 and Shadow of the Tomb Raider. However with wine-7.22, reverting the usleep(0) patch causes no behavior changes. For Shadow of the Tomb Raider, the 100% CPU issue is gone with or without the patch. For StarCraft 2, there is always a thread taking 100% CPU even with the patch. After discussing with Matteo, we decided it's better to revert the patch.
Fix Mortal Kombat X performance drop during tower selection and Ragnarok Online bad performance.
This reverts commit e86b4015ff405d4c054b8a5bc855ee655e1a833c.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53327 --- dlls/ntdll/unix/sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 650e32a7d41..a0905963562 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1494,7 +1494,7 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou }
/* Note that we yield after establishing the desired timeout */ - usleep(0); + NtYieldExecution(); if (!when) return STATUS_SUCCESS;
for (;;)
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=127289
Your paranoid android.
=== debian11 (32 bit report) ===
winhttp: notification.c:122: Test failed: 943: expected callback to be called from the same thread notification.c:122: Test failed: 948: expected callback to be called from the same thread notification.c:122: Test failed: 953: expected callback to be called from the same thread notification.c:997: Test failed: got 4 notification.c:1006: Test failed: got 0 notification.c:1010: Test failed: unexpected data 0 at 0 notification.c:1017: Test failed: got 0 notification.c:1018: Test failed: got 1002 notification.c:1019: Test failed: got 18 notification.c:1030: Test failed: got 1002 notification.c:122: Test failed: 937: expected callback to be called from the same thread notification.c:122: Test failed: 943: expected callback to be called from the same thread notification.c:122: Test failed: 948: expected callback to be called from the same thread notification.c:122: Test failed: 953: expected callback to be called from the same thread
This merge request was approved by Matteo Bruni.