eal: store control thread CPU affinity in TLS
authorJerin Jacob <jerinj@marvell.com>
Wed, 5 Feb 2020 10:24:15 +0000 (15:54 +0530)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 24 Mar 2020 12:44:41 +0000 (13:44 +0100)
_cpuset TLS variable stores the CPU affinity of eal thread.
Populate the _cpuset TLS variable for control thread to

1) Make rte_thread_get_affinity() and eal_thread_dump_affinity
functional with control thread.
2) Quick access to cpu affinity.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
lib/librte_eal/common/eal_common_thread.c

index 7858175..99fe1aa 100644 (file)
@@ -152,10 +152,14 @@ struct rte_thread_ctrl_params {
 static void *rte_thread_init(void *arg)
 {
        int ret;
+       rte_cpuset_t *cpuset = &internal_config.ctrl_cpuset;
        struct rte_thread_ctrl_params *params = arg;
        void *(*start_routine)(void *) = params->start_routine;
        void *routine_arg = params->arg;
 
+       /* Store cpuset in TLS for quick access */
+       memmove(&RTE_PER_LCORE(_cpuset), cpuset, sizeof(rte_cpuset_t));
+
        ret = pthread_barrier_wait(&params->configured);
        if (ret == PTHREAD_BARRIER_SERIAL_THREAD) {
                pthread_barrier_destroy(&params->configured);