From aa2fe8ccbfcb117efa207d10229eeeac5d0f97c7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 Feb 2023 17:11:30 +0100 Subject: Adding upstream version 1.38.0. Signed-off-by: Daniel Baumann --- collectors/ebpf.plugin/ebpf_process.c | 72 +---------------------------------- 1 file changed, 2 insertions(+), 70 deletions(-) (limited to 'collectors/ebpf.plugin/ebpf_process.c') diff --git a/collectors/ebpf.plugin/ebpf_process.c b/collectors/ebpf.plugin/ebpf_process.c index 682577da7..9a191d391 100644 --- a/collectors/ebpf.plugin/ebpf_process.c +++ b/collectors/ebpf.plugin/ebpf_process.c @@ -57,17 +57,6 @@ struct config process_config = { .first_section = NULL, static char *threads_stat[NETDATA_EBPF_THREAD_STAT_END] = {"total", "running"}; static char *load_event_stat[NETDATA_EBPF_LOAD_STAT_END] = {"legacy", "co-re"}; -static struct netdata_static_thread cgroup_thread = { - .name = "EBPF CGROUP", - .config_section = NULL, - .config_name = NULL, - .env_name = NULL, - .enabled = 1, - .thread = NULL, - .init_routine = NULL, - .start_routine = NULL -}; - /***************************************************************** * * PROCESS DATA AND SEND TO NETDATA @@ -326,55 +315,6 @@ static void ebpf_process_update_apps_data() } } -/** - * Cgroup Exit - * - * Function used with netdata_thread_clean_push - * - * @param ptr unused argument - */ -static void ebpf_cgroup_exit(void *ptr) -{ - UNUSED(ptr); -} - -/** - * Cgroup update shm - * - * This is the thread callback. - * This thread is necessary, because we cannot freeze the whole plugin to read the data from shared memory. - * - * @param ptr It is a NULL value for this thread. - * - * @return It always returns NULL. - */ -void *ebpf_cgroup_update_shm(void *ptr) -{ - netdata_thread_cleanup_push(ebpf_cgroup_exit, ptr); - heartbeat_t hb; - heartbeat_init(&hb); - - usec_t step = 3 * USEC_PER_SEC; - int counter = NETDATA_EBPF_CGROUP_UPDATE - 1; - //This will be cancelled by its parent - while (!ebpf_exit_plugin) { - (void)heartbeat_next(&hb, step); - - // We are using a small heartbeat time to wake up thread, - // but we should not update so frequently the shared memory data - if (++counter >= NETDATA_EBPF_CGROUP_UPDATE) { - counter = 0; - if (!shm_ebpf_cgroup.header) - ebpf_map_cgroup_shared_memory(); - - ebpf_parse_cgroup_shm_data(); - } - } - - netdata_thread_cleanup_pop(1); - return NULL; -} - /** * Update cgroup * @@ -745,7 +685,6 @@ static void ebpf_process_exit(void *ptr) pthread_mutex_lock(&ebpf_exit_cleanup); em->thread->enabled = NETDATA_THREAD_EBPF_STOPPED; pthread_mutex_unlock(&ebpf_exit_cleanup); - pthread_cancel(*cgroup_thread.thread); } /***************************************************************** @@ -1104,13 +1043,6 @@ void ebpf_send_statistic_data() */ static void process_collector(ebpf_module_t *em) { - // Start cgroup integration before other threads - cgroup_thread.thread = mallocz(sizeof(netdata_thread_t)); - cgroup_thread.start_routine = ebpf_cgroup_update_shm; - - netdata_thread_create(cgroup_thread.thread, cgroup_thread.name, NETDATA_THREAD_OPTION_DEFAULT, - ebpf_cgroup_update_shm, NULL); - heartbeat_t hb; heartbeat_init(&hb); int publish_global = em->global_charts; @@ -1152,7 +1084,7 @@ static void process_collector(ebpf_module_t *em) ebpf_process_update_apps_data(); } - if (cgroups) { + if (cgroups && shm_ebpf_cgroup.header) { ebpf_update_process_cgroup(); } } @@ -1169,7 +1101,7 @@ static void process_collector(ebpf_module_t *em) ebpf_process_send_apps_data(apps_groups_root_target, em); } - if (cgroups) { + if (cgroups && shm_ebpf_cgroup.header) { ebpf_process_send_cgroup_data(em); } } -- cgit v1.2.3