]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: activity: make taskprof use ptr_hash()
authorWilly Tarreau <w@1wt.eu>
Wed, 7 Sep 2022 09:27:25 +0000 (11:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Sep 2022 12:19:15 +0000 (14:19 +0200)
There's no more point using a different hash function here, xxh64 is
of course better distributed but we really don't care so let's unify
the code.

src/activity.c

index 67c1017b721f51b0ee0b35ea4afae1c07c2912eb..ee00e0c9357cbe717634208ce07fed707cd91f07 100644 (file)
@@ -21,7 +21,6 @@
 #include <haproxy/sc_strm.h>
 #include <haproxy/stconn.h>
 #include <haproxy/tools.h>
-#include <haproxy/xxhash.h>
 
 /* CLI context for the "show profiling" command */
 struct show_prof_ctx {
@@ -532,14 +531,10 @@ static int cmp_memprof_addr(const void *a, const void *b)
  */
 struct sched_activity *sched_activity_entry(struct sched_activity *array, const void *func)
 {
-       uint64_t hash = XXH64_avalanche(XXH64_mergeRound((size_t)func, (size_t)func));
+       uint32_t hash = ptr_hash(func, 8);
        struct sched_activity *ret;
        const void *old = NULL;
 
-       hash ^= (hash >> 32);
-       hash ^= (hash >> 16);
-       hash ^= (hash >> 8);
-       hash &= 0xff;
        ret = &array[hash];
 
        if (likely(ret->func == func))