]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: Have histogram types be constant when possible
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 22 Jul 2021 14:27:06 +0000 (10:27 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 16 Aug 2021 15:37:20 +0000 (11:37 -0400)
commitaf64c5392308104afdf35940138e33fab9ec8eb1
treee4d30c75539ad63456975d6bfafdca0cac753bef
parentccea15a661e4bbfa20e76454af8524b15c210fad
tracing: Have histogram types be constant when possible

Instead of kstrdup("const", GFP_KERNEL), have the hist_field type simply
assign the constant hist_field->type = "const"; And when the value passed
to it is a variable, use "kstrdup_const(var, GFP_KERNEL);" which will just
copy the value if the variable is already a constant. This saves on having
to allocate when not needed.

All frees of the hist_field->type will need to use kfree_const().

Link: https://lkml.kernel.org/r/20210722142837.280718447@goodmis.org
Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_events_hist.c