Main changes from HEAD: 1) Implements GetNumaHighestNodeNumber which simulates a typical single node system. 2) Implements GetNumaNodeProcessorMask which returns the global processor affinity mask for node 0, otherwise returns an error. 3) Implements GetNumaAvailableMemoryNode which returns available physical memory for node 0, otherwise returns an error.
This much of the behavior was observed based on a single processor (4 cores) Windows 7 system. These functions are utilized by the synchronization and threading primitives incorporated in the MSVC 2012 and newer C and C++ runtime libraries. concrt.h/Concurrency::critical_section, which is used by both std::mutex and std::thread, will throw an exception the moment the object is locked if GetNumaHighestNodeNumber fails, and there are at least a few examples of software which don't bother to catch this exception and thus crash, such as the alpha version of Cube World, and certain versions of the foo_wave_seekbar component for the foobar2000 audio player. The associated scheduling code appears to make use of GetNumaNodeProcessorMask as well to control how many threads are allowed to spin up at once, or so I guess without looking very deeply into the CRT source code.
2013/7/29 Chris Moeller kode54@gmail.com:
without looking very deeply into the CRT source code.
You're talking about MS source code, right? That makes you tainted for contributing to Wine at the very least for C runtime-related code :( If you haven't looked into any other source code, this patch might be okay (barring other issues, I haven't read the patch at all). At least http://wiki.winehq.org/DeveloperFaq#head-fed5011434f62ae1a88baebfb8193a37ea7... seems to suggest so.
Hi Chris.
Welcome to Wine.
Main changes from HEAD:
- Implements GetNumaHighestNodeNumber which simulates a typical single node system.
- Implements GetNumaNodeProcessorMask which returns the global processor affinity mask for node 0, otherwise returns an error.
- Implements GetNumaAvailableMemoryNode which returns available physical memory for node 0, otherwise returns an error.
The hacks from the codeweavers Wine tree are not in the main tree, because they are hacks. Wine has either a stub or proper implementation with tests.
For your changes: - SetLastError(0) is wrong. lasterror is only valid on a failure. (Exceptions are very very rare)
- Most implementations in kernel32.dll use functions provides by ntdll.dll With grep, you will find numa support in dlls/ntdll/nt.c
- Make the patches as small as possible: Only one implementation per Patch.
- Please add tests and run them on Windows. Ask here, if you need help. (Wine has a testbot for approved developer)
Thanks for improving Wine.