On Thu, Sep 13, 2018 at 11:48 AM, Michel Dänzer <mic...@daenzer.net> wrote: > On 2018-09-13 2:40 a.m., Marek Olšák wrote: >> From: Marek Olšák <marek.ol...@amd.com> >> >> [...] >> >> static void >> -util_init_cache_number(void) >> +util_init_thread_pinning(void) >> { >> /* Get a semi-random number. */ >> int64_t t = os_time_get_nano(); >> L3_cache_number = (t ^ (t >> 8) ^ (t >> 16)); >> + >> + /* Reset thread affinity for all children of fork and exec to prevent > > I don't think exec (which doesn't spawn a child, it replaces the current > process "image" with a new one) has anything to do with this. > > >> + * spawned processes and threads from inheriting the current thread's >> + * affinity. > > As the name implies, pthread_atfork only affects child processes spawned > with fork(), not new threads. As such, I'm afraid this won't help at > least for blender, which AFAICT doesn't call fork, it only spawns threads.
All created threads and processes are just some variants of fork. They all inherit affinity of the parent process/thread. This patch is enough to stop inheriting thread affinity from X and gnome-shell to GL apps, to gcc run within an X terminal, etc. Everything within X inherits the thread affinity of X or gnome-shell, including gcc. Marek _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev