diff options
Diffstat (limited to 'collectors/ebpf.plugin/ebpf_softirq.c')
-rw-r--r-- | collectors/ebpf.plugin/ebpf_softirq.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/collectors/ebpf.plugin/ebpf_softirq.c b/collectors/ebpf.plugin/ebpf_softirq.c index 01e2d0a528..b5c77bf06d 100644 --- a/collectors/ebpf.plugin/ebpf_softirq.c +++ b/collectors/ebpf.plugin/ebpf_softirq.c @@ -61,17 +61,18 @@ static softirq_val_t softirq_vals[] = { static softirq_ebpf_val_t *softirq_ebpf_vals = NULL; /** - * Cachestat Free + * Cleanup * - * Cleanup variables after child threads to stop + * Clean up allocated memory. * * @param ptr thread data. */ -static void ebpf_softirq_free(ebpf_module_t *em) +static void softirq_cleanup(void *ptr) { - pthread_mutex_lock(&ebpf_exit_cleanup); - em->enabled = NETDATA_THREAD_EBPF_STOPPING; - pthread_mutex_unlock(&ebpf_exit_cleanup); + ebpf_module_t *em = (ebpf_module_t *)ptr; + + if (em->objects) + ebpf_unload_legacy_code(em->objects, em->probe_links); for (int i = 0; softirq_tracepoints[i].class != NULL; i++) { ebpf_disable_tracepoint(&softirq_tracepoints[i]); @@ -83,19 +84,6 @@ static void ebpf_softirq_free(ebpf_module_t *em) pthread_mutex_unlock(&ebpf_exit_cleanup); } -/** - * Cleanup - * - * Clean up allocated memory. - * - * @param ptr thread data. - */ -static void softirq_cleanup(void *ptr) -{ - ebpf_module_t *em = (ebpf_module_t *)ptr; - ebpf_softirq_free(em); -} - /***************************************************************** * MAIN LOOP *****************************************************************/ |