[PATCH v1 25/26] perf inject: Use generic hashmap for aslr evsel_orig_attrs
From: Ian Rogers
Date: Fri Nov 13 2026 - 19:42:56 EST
Convert aslr_tool::evsel_orig_attrs in util/aslr.c to
DECLARE_HASHMAP(evsel_orig_attrs_map, struct evsel *,
struct aslr_evsel_priv *).
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/util/aslr.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/aslr.c b/tools/perf/util/aslr.c
index f9c961775e1d..8aaa685f4203 100644
--- a/tools/perf/util/aslr.c
+++ b/tools/perf/util/aslr.c
@@ -75,6 +75,7 @@ struct top_addresses_key;
DECLARE_HASHMAP(remap_addresses_map, struct remap_addresses_key *, u64 *);
DECLARE_HASHMAP(top_addresses_map, struct top_addresses_key *, struct process_top_address *);
+DECLARE_HASHMAP(evsel_orig_attrs_map, struct evsel *, struct aslr_evsel_priv *);
struct aslr_tool {
/** @tool: The tool implemented here and a pointer to a delegate to process the data. */
@@ -91,7 +92,7 @@ struct aslr_tool {
* @evsel_orig_attrs: mapping from evsel pointer to its original
* unstripped sample_type and registers bitmasks.
*/
- struct hashmap evsel_orig_attrs;
+ struct evsel_orig_attrs_map evsel_orig_attrs;
};
static const pid_t kernel_pid = -1;
@@ -1341,8 +1342,8 @@ void aslr_tool__delete(struct perf_tool *tool)
u64 *rval;
struct top_addresses_key *tkey;
struct process_top_address *tval;
- struct hashmap_entry *cur;
- size_t bkt;
+ struct evsel *ekey;
+ struct aslr_evsel_priv *eval;
struct rb_node *nd;
if (!tool)
@@ -1361,9 +1362,8 @@ void aslr_tool__delete(struct perf_tool *tool)
free(tkey);
free(tval);
}
- hashmap__for_each_entry(&aslr->evsel_orig_attrs, cur, bkt) {
- zfree(&cur->pvalue);
- }
+ hashmap__for_each(&aslr->evsel_orig_attrs, ekey, eval)
+ free(eval);
hashmap__clear(&aslr->remap_addresses);
hashmap__clear(&aslr->top_addresses);
--
2.56.1.703.gf848ed807c-goog