Skip to contentSkip to conversation

perf tools: Update copy of libbpf's hashmap.c

PATCH In review Arnaldo Carvalho de Melo 2 participants 2 messages Mar 29, 2022 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

PATCH 1/1 perf tools: Update copy of libbpf's hashmap.c

Just FYI, I'm carrying this patch in the perf tools tree.

- Arnaldo

---

To pick the changes in:

fba60b171a032283 ("libbpf: Use IS_ERR_OR_NULL() in hashmap__free()")

That don't entail any changes in tools/perf.

This addresses this perf build warning:

Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h' diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h

Not a kernel ABI, its just that this uses the mechanism in place for checking kernel ABI files drift.

Cc Andrii Nakryiko <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mauricio Vásquez <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/util/hashmap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/hashmap.c +1 -2
index 3c20b126d60d869a..aeb09c2887162d16 100644
@@ -75,7 +75,7 @@ void hashmap__clear(struct hashmap *map)
 
 void hashmap__free(struct hashmap *map)
 {
-	if (!map)
+	if (IS_ERR_OR_NULL(map))
 		return;
 
 	hashmap__clear(map);
@@ -238,4 +238,3 @@ bool hashmap__delete(struct hashmap *map, const void *key,
 
 	return true;
 }
-
Signature · 1 line
2.35.1
#1 lore raw
Quoted 3 lines · Arnaldo Carvalho de Melo

Just FYI, I'm carrying this patch in the perf tools tree.

Cool. I have some tentative plans to do some more changes to hashmap for improved API usability and performance, so you might need to pull a few more patches in the near future.

Quoted 49 lines

- Arnaldo

---

To pick the changes in:

fba60b171a032283 ("libbpf: Use IS_ERR_OR_NULL() in hashmap__free()")

That don't entail any changes in tools/perf.

This addresses this perf build warning:

Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h' diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h

Not a kernel ABI, its just that this uses the mechanism in place for checking kernel ABI files drift.

Cc Andrii Nakryiko <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mauricio Vásquez <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/util/hashmap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/hashmap.c +1 -3
index 3c20b126d60d869a..aeb09c2887162d16 100644
@@ -75,7 +75,7 @@ void hashmap__clear(struct hashmap *map)
 
 void hashmap__free(struct hashmap *map)
 {
-       if (!map)
+       if (IS_ERR_OR_NULL(map))
                return;
 
        hashmap__clear(map);
@@ -238,4 +238,3 @@ bool hashmap__delete(struct hashmap *map, const void *key,
 
        return true;
 }
-
--

2.35.1