]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf lock contention: Add and use LCB_F_TYPE_MASK
authorNamhyung Kim <namhyung@kernel.org>
Fri, 20 Dec 2024 06:00:06 +0000 (22:00 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 20 Dec 2024 20:36:06 +0000 (17:36 -0300)
This is a preparation for the later change.  It'll use more bits in the
flags so let's rename the type part and use the mask to extract the
type.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Song Liu <song@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Link: https://lore.kernel.org/r/20241220060009.507297-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-lock.c
tools/perf/util/bpf_skel/lock_data.h

index f66948b1fbed96de1297198de0aa45b572683d3d..d9f3477d2b02b61278bd150bafaf9f97591d43a6 100644 (file)
@@ -1490,7 +1490,7 @@ static const struct {
 
 static const char *get_type_str(unsigned int flags)
 {
-       flags &= LCB_F_MAX_FLAGS - 1;
+       flags &= LCB_F_TYPE_MASK;
 
        for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) {
                if (lock_type_table[i].flags == flags)
@@ -1501,7 +1501,7 @@ static const char *get_type_str(unsigned int flags)
 
 static const char *get_type_name(unsigned int flags)
 {
-       flags &= LCB_F_MAX_FLAGS - 1;
+       flags &= LCB_F_TYPE_MASK;
 
        for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) {
                if (lock_type_table[i].flags == flags)
index de12892f992f8d43e6a05baad516c11492d9545b..4f0aae5483745dfafcef3741a88e383b8650cafc 100644 (file)
@@ -32,7 +32,8 @@ struct contention_task_data {
 #define LCD_F_MMAP_LOCK                (1U << 31)
 #define LCD_F_SIGHAND_LOCK     (1U << 30)
 
-#define LCB_F_MAX_FLAGS                (1U << 7)
+#define LCB_F_TYPE_MAX         (1U << 7)
+#define LCB_F_TYPE_MASK                0x0000007FU
 
 struct contention_data {
        u64 total_time;