diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2019-05-28 18:06:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-28 18:06:38 +0200 |
commit | 3489e56c875c6144c729b51063300c7d60b1ae31 (patch) | |
tree | d00230bcefd3855b81197d1392ad64d749834ba1 /src/pal/src/config.h.in | |
parent | 9f3e89dd8634781f425a60f9a635787d0820d63d (diff) | |
download | coreclr-3489e56c875c6144c729b51063300c7d60b1ae31.tar.gz coreclr-3489e56c875c6144c729b51063300c7d60b1ae31.tar.bz2 coreclr-3489e56c875c6144c729b51063300c7d60b1ae31.zip |
Fix initial thread affinity on Linux (#24801)
* Fix initial thread affinity on Linux
On Linux, a new thread inherits the affinity mask of the thread
that created the new thread. This is a problem for background GC
threads that are created by one of the server GC threads that are
affinitized to single core.
This change adds resetting each new thread affinity to match the
current process affinity.
In addition to that, I've also fixed the extraction of the CPU count
that was using PID 0. While the doc says that 0 represents current process,
it in fact means current thread.
And as a small bonus, I've added caching of the value returned by
the PAL_GetLogicalCpuCountFromOS, since it cannot change during runtime.
Diffstat (limited to 'src/pal/src/config.h.in')
-rw-r--r-- | src/pal/src/config.h.in | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in index 3ceb180563..505b2ee208 100644 --- a/src/pal/src/config.h.in +++ b/src/pal/src/config.h.in @@ -36,6 +36,7 @@ #cmakedefine01 HAVE_PTHREAD_GETCPUCLOCKID #cmakedefine01 HAVE_PTHREAD_SIGQUEUE #cmakedefine01 HAVE_PTHREAD_GETAFFINITY_NP +#cmakedefine01 HAVE_PTHREAD_ATTR_SETAFFINITY_NP #cmakedefine01 HAVE_CPUSET_T #cmakedefine01 HAVE_SIGRETURN #cmakedefine01 HAVE__THREAD_SYS_SIGRETURN |