From 9abec302a4736c965a34b930f4f5bf2b1494bf6e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 27 Jun 2023 20:46:10 +0200 Subject: Adding upstream version 1.40.1. Signed-off-by: Daniel Baumann --- collectors/ebpf.plugin/ebpf_softirq.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'collectors/ebpf.plugin/ebpf_softirq.c') diff --git a/collectors/ebpf.plugin/ebpf_softirq.c b/collectors/ebpf.plugin/ebpf_softirq.c index 01e2d0a52..b5c77bf06 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 *****************************************************************/ -- cgit v1.2.3