]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf tools: Make more global variables static
authorIan Rogers <irogers@google.com>
Wed, 8 Apr 2026 17:31:58 +0000 (14:31 -0300)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 9 Apr 2026 02:21:04 +0000 (19:21 -0700)
commit046fd8206d820b71e7870f7b894b46f8a15ae974
tree1d29686d0e2bf7ecb0da980d169d9b4010041cda
parente5cce1b9c82fbd48e2f1f7a25a9fad8ee228176f
perf tools: Make more global variables static

`make check` will run sparse on the perf code base. A frequent warning
is "warning: symbol '...' was not declared. Should it be static?" Go
through and make global definitions without declarations static.

In some cases it is deliberate due to dlsym accessing the symbol, this
change doesn't clean up the missing declarations for perf test suites.

Sometimes things can opportunistically be made const.

Making somethings static exposed unused functions warnings, so
restructuring of ifdefs was necessary for that.

These changes reduce the size of the perf binary by 568 bytes.

Committer notes:

Refreshed the patch, the original one fell thru the cracks, updated the
size reduction.

Remove the trace-event-scripting.c changes, break the build, noticed
with container builds and with sashiko:

  https://sashiko.dev/#/patchset/20260401215306.2152898-1-acme%40kernel.org

Also make two variables static to address another sashiko review
comment:

  https://sashiko.dev/#/patchset/20260402001740.2220481-1-acme%40kernel.org

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Ankur Arora <ankur.a.arora@oracle.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Guo Ren <guoren@kernel.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yujie Liu <yujie.liu@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
24 files changed:
tools/perf/arch/common.c
tools/perf/arch/sh/include/dwarf-regs-table.h
tools/perf/bench/breakpoint.c
tools/perf/bench/mem-functions.c
tools/perf/bench/numa.c
tools/perf/bench/uprobe.c
tools/perf/builtin-c2c.c
tools/perf/builtin-config.c
tools/perf/builtin-data.c
tools/perf/builtin-diff.c
tools/perf/builtin-kmem.c
tools/perf/builtin-kwork.c
tools/perf/builtin-script.c
tools/perf/builtin-top.c
tools/perf/tests/bp_signal.c
tools/perf/tests/dso-data.c
tools/perf/tests/wp.c
tools/perf/util/block-range.c
tools/perf/util/bpf_counter.c
tools/perf/util/bpf_off_cpu.c
tools/perf/util/debug.c
tools/perf/util/debuginfo.c
tools/perf/util/sort.c
tools/perf/util/util.c