Fix: populate possible num possible cpus cache with fd tracker lock 2.12-custom-upgrade
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 10 Oct 2022 15:53:50 +0000 (16:53 +0100)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 10 Oct 2022 16:01:10 +0000 (17:01 +0100)
num_possible_cpus internally opens and closes file descriptors.
Initialize the cache with fd tracker lock held to prevent concurrent use
of close/closeall/closefrom.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib16c73f11af0b0cb163b38b0b096a86f6ae86325

liblttng-ust/lttng-ust-comm.c

index 716795e0e818028d1a6fc6fa63374abaaf0ebafa..6f70f8f0a629b45682850c8343992964838ca3e7 100644 (file)
@@ -56,6 +56,7 @@
 #include "lttng-tracer-core.h"
 #include "compat.h"
 #include "../libringbuffer/rb-init.h"
+#include "../libringbuffer/smp.h"
 #include "lttng-ust-statedump.h"
 #include "clock.h"
 #include "../libringbuffer/getcpu.h"
@@ -1891,6 +1892,12 @@ void __attribute__((constructor)) lttng_ust_init(void)
        lttng_ust_clock_init();
        lttng_ust_getcpu_init();
        lttng_ust_statedump_init();
+       /*
+        * Populate possible cpus cache with the fd tracker lock held.
+        */
+       lttng_ust_lock_fd_tracker();
+       (void) num_possible_cpus();
+       lttng_ust_unlock_fd_tracker();
        lttng_ring_buffer_metadata_client_init();
        lttng_ring_buffer_client_overwrite_init();
        lttng_ring_buffer_client_overwrite_rt_init();
This page took 0.030704 seconds and 5 git commands to generate.