From: Marek Olšák <[email protected]>
---
src/util/u_queue.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/util/u_queue.c b/src/util/u_queue.c
index 22d2cdd0fa2..9dd1a69ed7a 100644
--- a/src/util/u_queue.c
+++ b/src/util/u_queue.c
@@ -232,20 +232,32 @@ struct thread_input {
};
static int
util_queue_thread_func(void *input)
{
struct util_queue *queue = ((struct thread_input*)input)->queue;
int thread_index = ((struct thread_input*)input)->thread_index;
free(input);
+#ifdef HAVE_PTHREAD_SETAFFINITY
+ /* Don't inherit the thread affinity from the parent thread.
+ * Set the full mask.
+ */
+ cpu_set_t cpuset;
+ CPU_ZERO(&cpuset);
+ for (unsigned i = 0; i < CPU_SETSIZE; i++)
+ CPU_SET(i, &cpuset);
+
+ pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
+#endif
+
if (strlen(queue->name) > 0) {
char name[16];
util_snprintf(name, sizeof(name), "%s%i", queue->name, thread_index);
u_thread_setname(name);
}
while (1) {
struct util_queue_job job;
mtx_lock(&queue->lock);
--
2.17.1
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev