Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf lock contention: Fix a build error on 32-bit

It was reported that it failed to build the BPF lock contention skeleton
on 32 bit arch due to the size of long. The lost count is used only for
reporting errors due to lack of stackmap space through bad_hist which
type is 'int'. Let's use int type then.

Fixes: 6d499a6b3d90277d ("perf lock: Print the number of lost entries for BPF")
Reported-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Link: http://lore.kernel.org/lkml/20220926215638.3931222-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
433b31fa c7c43e38

+2 -2
+1 -1
tools/perf/util/bpf_skel/lock_contention.bpf.c
··· 75 75 int stack_skip; 76 76 77 77 /* error stat */ 78 - unsigned long lost; 78 + int lost; 79 79 80 80 static inline int can_record(void) 81 81 {
+1 -1
tools/perf/util/lock-contention.h
··· 114 114 struct machine *machine; 115 115 struct hlist_head *result; 116 116 unsigned long map_nr_entries; 117 - unsigned long lost; 117 + int lost; 118 118 int max_stack; 119 119 int stack_skip; 120 120 };