summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-09-14 20:10:28 +0200
committerLennart Poettering <lennart@poettering.net>2009-09-14 20:10:28 +0200
commit6a093738d55aeaa306df2ad0e05da09a09bfaafc (patch)
treeb1a6f2ad1db77a536ca75b20124eb331d9b047ca
parentf72f5986fd3766a0a31b9feed724dcaa878732ee (diff)
increase hash table size
-rw-r--r--mutrace.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/mutrace.c b/mutrace.c
index e02a011..4375e4d 100644
--- a/mutrace.c
+++ b/mutrace.c
@@ -49,7 +49,7 @@ struct mutex_info {
struct mutex_info *next;
};
-static unsigned long hash_size = 557;
+static unsigned long hash_size = 3371; /* probably a good idea to pick a prime here */
static unsigned long frames_max = 16;
static volatile unsigned n_broken = 0;
@@ -179,11 +179,8 @@ static unsigned long mutex_hash(pthread_mutex_t *mutex) {
unsigned long u;
u = (unsigned long) mutex;
- do {
- u = (u % hash_size) ^ (u / hash_size);
- } while (u > hash_size);
-
- return u;
+ u /= sizeof(void*);
+ return u % hash_size;
}
static void lock_hash_mutex(unsigned u) {