Fix: use vmalloc for filter bytecode allocation
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 25 Nov 2020 18:29:47 +0000 (13:29 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 25 Nov 2020 18:29:47 +0000 (13:29 -0500)
Given that the filter bytecode can reach 64kB, use vmalloc rather than
kmalloc to minimize the chances of failure on systems with fragmented
memory.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/lttng-events.c

index d1a0706e0b9793b525e5c66212ac23b9e85d0614..9b78ac56f5d43b0fcae0e3d60a38c18965419d04 100644 (file)
@@ -2225,7 +2225,7 @@ int lttng_enabler_attach_filter_bytecode(struct lttng_enabler *enabler,
        ret = get_user(bytecode_len, &bytecode->len);
        if (ret)
                return ret;
-       bytecode_node = kzalloc(sizeof(*bytecode_node) + bytecode_len,
+       bytecode_node = lttng_kvzalloc(sizeof(*bytecode_node) + bytecode_len,
                        GFP_KERNEL);
        if (!bytecode_node)
                return -ENOMEM;
@@ -2243,7 +2243,7 @@ int lttng_enabler_attach_filter_bytecode(struct lttng_enabler *enabler,
        return 0;
 
 error_free:
-       kfree(bytecode_node);
+       lttng_kvfree(bytecode_node);
        return ret;
 }
 
@@ -2289,7 +2289,7 @@ void lttng_enabler_destroy(struct lttng_enabler *enabler)
        /* Destroy filter bytecode */
        list_for_each_entry_safe(filter_node, tmp_filter_node,
                        &enabler->filter_bytecode_head, node) {
-               kfree(filter_node);
+               lttng_kvfree(filter_node);
        }
 }
 
This page took 0.033486 seconds and 4 git commands to generate.