From: Mathieu Desnoyers Date: Wed, 25 Nov 2020 18:29:47 +0000 (-0500) Subject: Fix: use vmalloc for filter bytecode allocation X-Git-Tag: v2.13.0-rc1~89 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=52cfcdf36dfa58e0b6fb0ac3e1809e5a2538a149;p=lttng-modules.git Fix: use vmalloc for filter bytecode allocation 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 --- diff --git a/src/lttng-events.c b/src/lttng-events.c index d1a0706e..9b78ac56 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -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); } }