Cleanup: statedump process state event pid namespace fields
[deliverable/lttng-modules.git] / lttng-events.c
index 3964df5fbb2f55b8d98fdb8501023a2c37a2dbab..a4570b7b45a7d175ec2cf03680c7376786464eef 100644 (file)
@@ -27,8 +27,8 @@
 #include <linux/jhash.h>
 #include <linux/uaccess.h>
 #include <linux/vmalloc.h>
+#include <linux/uuid.h>
 
-#include <wrapper/uuid.h>
 #include <wrapper/vmalloc.h>   /* for wrapper_vmalloc_sync_all() */
 #include <wrapper/random.h>
 #include <wrapper/tracepoint.h>
@@ -40,7 +40,6 @@
 #include <lttng-abi-old.h>
 #include <lttng-endian.h>
 #include <lttng-string-utils.h>
-#include <wrapper/vzalloc.h>
 #include <wrapper/ringbuffer/backend.h>
 #include <wrapper/ringbuffer/frontend.h>
 
@@ -76,7 +75,12 @@ int _lttng_field_statedump(struct lttng_session *session,
 
 void synchronize_trace(void)
 {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
+       synchronize_rcu();
+#else
        synchronize_sched();
+#endif
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
 #ifdef CONFIG_PREEMPT_RT_FULL
        synchronize_rcu();
@@ -130,7 +134,7 @@ struct lttng_session *lttng_session_create(void)
                        GFP_KERNEL);
        if (!metadata_cache)
                goto err_free_session;
-       metadata_cache->data = lttng_vzalloc(METADATA_CACHE_DEFAULT_SIZE);
+       metadata_cache->data = vzalloc(METADATA_CACHE_DEFAULT_SIZE);
        if (!metadata_cache->data)
                goto err_free_cache;
        metadata_cache->cache_alloc = METADATA_CACHE_DEFAULT_SIZE;
@@ -226,6 +230,9 @@ int lttng_session_enable(struct lttng_session *session)
        /* Set transient enabler state to "enabled" */
        session->tstate = 1;
 
+       /* We need to sync enablers with session before activation. */
+       lttng_session_sync_enablers(session);
+
        /*
         * Snapshot the number of events per channel to know the type of header
         * we need to use.
@@ -239,9 +246,6 @@ int lttng_session_enable(struct lttng_session *session)
                        chan->header_type = 2;  /* large */
        }
 
-       /* We need to sync enablers with session before activation. */
-       lttng_session_sync_enablers(session);
-
        /* Clear each stream's quiescent state. */
        list_for_each_entry(chan, &session->chan, list) {
                if (chan->channel_type != METADATA_CHANNEL)
@@ -1136,8 +1140,8 @@ int lttng_session_list_tracker_pids(struct lttng_session *session)
                ret = PTR_ERR(tracker_pids_list_file);
                goto file_error;
        }
-       if (atomic_long_add_unless(&session->file->f_count,
-               1, INT_MAX) == INT_MAX) {
+       if (!atomic_long_add_unless(&session->file->f_count, 1, LONG_MAX)) {
+               ret = -EOVERFLOW;
                goto refcount_error;
        }
        ret = lttng_tracker_pids_list_fops.open(NULL, tracker_pids_list_file);
@@ -1692,7 +1696,7 @@ int lttng_metadata_printf(struct lttng_session *session,
                tmp_cache_alloc_size = max_t(unsigned int,
                                session->metadata_cache->cache_alloc + len,
                                session->metadata_cache->cache_alloc << 1);
-               tmp_cache_realloc = lttng_vzalloc(tmp_cache_alloc_size);
+               tmp_cache_realloc = vzalloc(tmp_cache_alloc_size);
                if (!tmp_cache_realloc)
                        goto err;
                if (session->metadata_cache->data) {
This page took 0.033819 seconds and 5 git commands to generate.