From 0f98e1c6d324a7d17b6e7bdb7b1b41d3a2db9954 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 15 Sep 2016 16:09:00 -0500 Subject: [PATCH] eina_thread: Don't ensure affinity core is lower than number of cpus CPUs can be turned off after boot leading to a sparse mapping of core ids. For example, if I turn off the first four cores on an exynos 5422 (these are the low speed cores) then the high speed cores are still numbered 4-7 but there are only 4 cores present. In that situation using affinity_core % num_cpus will prevent ever being able to set affinity at all. Just remove the pointless check and let the user set whatever core id they want. --- src/lib/eina/eina_thread.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c index 5002a42dfb..f698092ef2 100644 --- a/src/lib/eina/eina_thread.c +++ b/src/lib/eina/eina_thread.c @@ -70,12 +70,9 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi { #ifdef EINA_HAVE_PTHREAD_AFFINITY cpu_set_t cpu; - int cpunum; - - cpunum = eina_cpu_count(); CPU_ZERO(&cpu); - CPU_SET(affinity % cpunum, &cpu); + CPU_SET(affinity, &cpu); pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu); #endif }