On Wed, 09 Oct 2024 13:20:08 -0700, Namhyung Kim wrote: > The hashmap__for_each_entry[_safe] is accessing 'map' as if it's a > pointer. But it does without parentheses so passing a static hash map > with an ampersand (like &slab_hash below) caused compiler warnings due > to unmatched types. > > In file included from util/bpf_lock_contention.c:5: > util/bpf_lock_contention.c: In function ‘exit_slab_cache_iter’: > linux/tools/perf/util/hashmap.h:169:32: error: invalid type argument of ‘->’ (have ‘struct hashmap’) > 169 | for (bkt = 0; bkt < map->cap; bkt++) \ > | ^~ > util/bpf_lock_contention.c:105:9: note: in expansion of macro ‘hashmap__for_each_entry’ > 105 | hashmap__for_each_entry(&slab_hash, cur, bkt) > | ^~~~~~~~~~~~~~~~~~~~~~~ > /home/namhyung/project/linux/tools/perf/util/hashmap.h:170:31: error: invalid type argument of ‘->’ (have ‘struct hashmap’) > 170 | for (cur = map->buckets[bkt]; cur; cur = cur->next) > | ^~ > util/bpf_lock_contention.c:105:9: note: in expansion of macro ‘hashmap__for_each_entry’ > 105 | hashmap__for_each_entry(&slab_hash, cur, bkt) > | ^~~~~~~~~~~~~~~~~~~~~~~ > > [...] Applied to perf-tools-next, thanks! Best regards, Namhyung