Uh oh!
There was an error while loading. Please reload this page.
Revert "A few fixes in the threadpool semaphore. Unify Windows/Unix implementation of LIFO policy." - #125193
Conversation
…mplement…" This reverts commit fbf6be5.
Tagging subscribers to this area: @agocke, @VSadov |
There was a problem hiding this comment.
Pull request overview
This PR reverts PR #123921 which had unified the Windows/Unix LIFO semaphore implementation and introduced futex-based thread blocking. The revert is motivated by a confirmed 10-15% regression in NuGet restore performance caused by the original change. The revert restores the original platform-specific LowLevelLifoSemaphore implementations (IO Completion Port on Windows, WaitSubsystem on Unix), removes the futex infrastructure (LowLevelFutex, LowLevelThreadBlocker), and reverts the spinning heuristics and Backoff.Exponential changes.
Changes:
- Restores platform-specific
LowLevelLifoSemaphoreimplementations (LowLevelLifoSemaphore.Windows.csusing IO Completion Ports,LowLevelLifoSemaphore.Unix.csusingWaitSubsystem) and removes the unified futex-based thread blocking infrastructure. - Reverts the thread pool semaphore spinning strategy from an adaptive per-core-availability approach back to a simple configurable spin count with random exponential backoff.
- Removes the
Synchronization.libdependency andWaitOnAddress/WakeByAddressSingleWin32 API usage across managed and native code.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/native/libs/System.Native/pal_threading.h | Removes futex function declarations |
src/native/libs/System.Native/pal_threading.c | Removes futex function implementations (Linux syscall + fallback) |
src/native/libs/System.Native/entrypoints.c | Removes futex DllImport entries |
src/libraries/.../PortableThreadPool.WorkerThread.cs | Reverts semaphore Wait call to 1-param, restores spin count config at call site |
src/libraries/.../LowLevelThreadBlocker.cs | Deletes unified thread blocker class |
src/libraries/.../LowLevelLifoSemaphore.cs | Reverts to platform-dispatching partial class with simpler spin logic |
src/libraries/.../LowLevelLifoSemaphore.Windows.cs | Restores IOCP-based Windows implementation |
src/libraries/.../LowLevelLifoSemaphore.Unix.cs | Restores WaitSubsystem-based Unix implementation |
src/libraries/.../LowLevelFutex.Windows.cs | Deletes Windows futex wrapper |
src/libraries/.../LowLevelFutex.Unix.cs | Deletes Unix futex wrapper |
src/libraries/.../Backoff.cs | Reverts to void return, removes attempt>0 guard, restores max bits to 14 |
src/libraries/.../System.Private.CoreLib.Shared.projitems | Updates build item includes for restored/removed files |
src/libraries/.../Interop.WaitOnAddress.cs | Deletes WaitOnAddress/WakeByAddressSingle P/Invoke |
src/libraries/.../Interop.CriticalSection.cs | Removes [SuppressGCTransition] from LeaveCriticalSection |
src/libraries/.../Interop.Libraries.cs | Removes Synch library constant, adds duplicate Oleaut32 |
src/libraries/.../Interop.LowLevelMonitor.cs | Removes [SuppressGCTransition] from LowLevelMonitor_Release |
src/libraries/.../Interop.Futex.cs | Deletes futex P/Invoke declarations |
src/coreclr/.../reproNative.vcxproj | Removes Synchronization.lib from SDK libs |
src/coreclr/.../WindowsAPIs.txt | Removes WaitOnAddress/WakeByAddressSingle API entries |
src/coreclr/.../Microsoft.NETCore.Native.Windows.targets | Removes Synchronization.lib |
docs/coding-guidelines/interop-guidelines.md | Reverts documentation examples to pre-#123921 state |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
agocke
commented
Mar 5, 2026
/ba-g known issue filed |
Uh oh!
There was an error while loading. Please reload this page.
…implementation of LIFO policy." (dotnet#125193) This reverts commit 51b1e92.
Reverts #123921
This change appears to have caused a large regression in NuGet restore performance. Reverting is confirmed to produce a significant improvement (10-15%).