Change malloc to zmalloc for libust
authorDavid Goulet <david.goulet@polymtl.ca>
Tue, 7 Sep 2010 13:03:41 +0000 (15:03 +0200)
committerNils Carlson <nils.carlson@ericsson.com>
Tue, 7 Sep 2010 14:23:55 +0000 (16:23 +0200)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
libust/buffers.c
libust/marker.c
libust/tracectl.c
libust/tracepoint.c

index 5d9bb8ec87ab566bdf58fe476e2b8a20f58407de..374ec613240fde5028fbac694b9a4d49a22c20c8 100644 (file)
@@ -777,11 +777,11 @@ static int ust_buffers_create_channel(const char *trace_name, struct ust_trace *
        ltt_chan->commit_count_mask = (~0UL >> ltt_chan->n_subbufs_order);
        ltt_chan->n_cpus = get_n_cpus();
 //ust//        ltt_chan->buf = percpu_alloc_mask(sizeof(struct ltt_channel_buf_struct), GFP_KERNEL, cpu_possible_map);
-       ltt_chan->buf = (void *) malloc(ltt_chan->n_cpus * sizeof(void *));
+       ltt_chan->buf = (void *) zmalloc(ltt_chan->n_cpus * sizeof(void *));
        if(ltt_chan->buf == NULL) {
                goto error;
        }
-       ltt_chan->buf_struct_shmids = (int *) malloc(ltt_chan->n_cpus * sizeof(int));
+       ltt_chan->buf_struct_shmids = (int *) zmalloc(ltt_chan->n_cpus * sizeof(int));
        if(ltt_chan->buf_struct_shmids == NULL)
                goto free_buf;
 
index 19467d19bba9272bc3af2d1e37507d25f2505685..3351726aaa17954e2dcbb4169836032c4c326060 100644 (file)
@@ -428,10 +428,10 @@ static struct marker_entry *add_marker(const char *channel, const char *name,
                }
        }
        /*
-        * Using malloc here to allocate a variable length element. Could
+        * Using zmalloc here to allocate a variable length element. Could
         * cause some memory fragmentation if overused.
         */
-       e = malloc(sizeof(struct marker_entry)
+       e = zmalloc(sizeof(struct marker_entry)
                    + channel_len + name_len + format_len);
        if (!e)
                return ERR_PTR(-ENOMEM);
@@ -1363,7 +1363,7 @@ int marker_register_lib(struct marker *markers_start, int markers_count)
 {
        struct lib *pl;
 
-       pl = (struct lib *) malloc(sizeof(struct lib));
+       pl = (struct lib *) zmalloc(sizeof(struct lib));
 
        pl->markers_start = markers_start;
        pl->markers_count = markers_count;
index 8d57b8fe9324be657629fd3994668437fc86d1dd..e64b26f7cf85dc6ad2718d508f0e95d2cd226c8d 100644 (file)
@@ -675,9 +675,9 @@ static int do_cmd_get_subbuffer(const char *recvbuf, struct ustcomm_source *src)
 
                        found = 1;
 
-                       bc = (struct blocked_consumer *) malloc(sizeof(struct blocked_consumer));
+                       bc = (struct blocked_consumer *) zmalloc(sizeof(struct blocked_consumer));
                        if(bc == NULL) {
-                               ERR("malloc returned NULL");
+                               ERR("zmalloc returned NULL");
                                goto unlock_traces;
                        }
                        bc->fd_consumer = src->fd;
index 620a009cf333539fe5bd263fadd4ba0f762351ba..8783b53084971074bd2ac60a45527dd17505aad1 100644 (file)
@@ -74,7 +74,7 @@ struct tp_probes {
 
 static inline void *allocate_probes(int count)
 {
-       struct tp_probes *p  = malloc(count * sizeof(struct probe)
+       struct tp_probes *p  = zmalloc(count * sizeof(void *)
                        + sizeof(struct tp_probes));
        return p == NULL ? NULL : p->probes;
 }
@@ -225,10 +225,10 @@ static struct tracepoint_entry *add_tracepoint(const char *name)
                }
        }
        /*
-        * Using kmalloc here to allocate a variable length element. Could
+        * Using zmalloc here to allocate a variable length element. Could
         * cause some memory fragmentation if overused.
         */
-       e = malloc(sizeof(struct tracepoint_entry) + name_len);
+       e = zmalloc(sizeof(struct tracepoint_entry) + name_len);
        if (!e)
                return ERR_PTR(-ENOMEM);
        memcpy(&e->name[0], name, name_len);
@@ -661,7 +661,7 @@ int tracepoint_register_lib(struct tracepoint *tracepoints_start, int tracepoint
 {
        struct tracepoint_lib *pl;
 
-       pl = (struct tracepoint_lib *) malloc(sizeof(struct tracepoint_lib));
+       pl = (struct tracepoint_lib *) zmalloc(sizeof(struct tracepoint_lib));
 
        pl->tracepoints_start = tracepoints_start;
        pl->tracepoints_count = tracepoints_count;
This page took 0.02763 seconds and 4 git commands to generate.