eal: detach interrupt and worker threads
PATCH 1/1 eal: detach interrupt and worker threads
The EAL library does not wait (pthread_join) these threads so the should be detached so that library can release resources. This shows up when looking for memory leaks with tools like valgrind.
Signed-off-by Stephen Hemminger <[email protected]>
--- lib/eal/freebsd/eal.c | 3 +++ lib/eal/linux/eal.c | 6 ++++++ lib/eal/linux/eal_interrupts.c | 3 +++ 3 files changed, 12 insertions(+)
lib/eal/freebsd/eal.c +3 -0
@@ -899,6 +899,9 @@ rte_eal_init(int argc, char **argv) sizeof(rte_cpuset_t), &lcore_config[i].cpuset);if (ret !=0 )rte_panic ("Cannot set affinity\n" ); + +/* worker threads are never joined */ +pthread_detach (lcore_config[i].thread_id); }/*
lib/eal/linux/eal.c +6 -0
@@ -1267,6 +1267,12 @@ rte_eal_init(int argc, char **argv) sizeof(rte_cpuset_t), &lcore_config[i].cpuset);if (ret !=0 )rte_panic ("Cannot set affinity\n" ); + +/* worker threads are never joined */ + ret =pthread_detach (lcore_config[i].thread_id); +if (ret !=0 ) +RTE_LOG (DEBUG ,EAL , +"Cannot detach lcore thread\n" ); }/*
lib/eal/linux/eal_interrupts.c +3 -0
@@ -1175,6 +1175,9 @@ rte_eal_intr_init(void) "Failed to create thread for interrupt handling\n"); } +/* the interrupt thread is never joined */ +pthread_detach (intr_thread); +return ret; }
Signature · 1 line
2.30.2
Quoted 5 lines · Stephen Hemminger
The EAL library does not wait (
pthread_join) these threads so the should be detached so that library can release resources. This shows up when looking for memory leaks with tools like valgrind.
The FreeBSD interrupt thread can be detached too.
There is also the hpet-msb-inc thread in Linux that could be detached, maybe in a followup patch?
Quoted 2 lines
Signed-off-by Stephen Hemminger <[email protected]>
With FreeBSD interrupt thread addition, you can add:
Reviewed-by David Marchand <[email protected]>
Signature · 1 line
David Marchand