Skip to content

Commit 09da593

Browse files
qianfengrongrostedt
authored andcommitted
tracing: Use vmalloc_array() to improve code
Remove array_size() calls and replace vmalloc() with vmalloc_array() in tracing_map_sort_entries(). vmalloc_array() is optimized better, uses fewer instructions, and handles overflow more concisely[1]. [1]: https://lore.kernel.org/lkml/[email protected]/ Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Qianfeng Rong <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 3add2d3 commit 09da593

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/tracing_map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ int tracing_map_sort_entries(struct tracing_map *map,
10761076
struct tracing_map_sort_entry *sort_entry, **entries;
10771077
int i, n_entries, ret;
10781078

1079-
entries = vmalloc(array_size(sizeof(sort_entry), map->max_elts));
1079+
entries = vmalloc_array(map->max_elts, sizeof(sort_entry));
10801080
if (!entries)
10811081
return -ENOMEM;
10821082

0 commit comments

Comments
 (0)