On Tue, Oct 2, 2018 at 6:30 PM Marek Olšák <mar...@gmail.com> wrote:
>
> From: Marek Olšák <marek.ol...@amd.com>
>
> ---
>  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


Just curious (and maybe I missed some previous discussion), would this
override taskset?

Asking because when benchmarking on big/little arm SoCs I tend to use
taskset to pin things to either the fast cores or slow cores, to
eliminate a source of uncertainty in the result.  (And I use u_queue
to split of the 2nd half of batch submits, Ie. the part that generates
gmem/tiling cmds and does the kernel submit ioctl).  Would be slightly
annoying to loose that ability to control which group of cores the
u_queue thread runs on.

(But admittedly this is kind of an edge case, so I guess an env var to
override the behavior would be ok.)

BR,
-R


> +
>     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
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to