From 7bbced66adcfdf51da5a6562e5375135afd56cfc Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Tue, 3 Mar 2020 19:10:57 +0100 Subject: [PATCH] regression: fix ck_hclh regression test. When defining the LOCK macro, make sure we calculate the index for the local_lock right, core % (CORES / 2) sounds way better than (core % CORES) / 2, especially when CORES is an odd number. This should fix github issue #153. --- regressions/ck_spinlock/ck_hclh.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regressions/ck_spinlock/ck_hclh.h b/regressions/ck_spinlock/ck_hclh.h index 1dfddbd..cdc0474 100644 --- a/regressions/ck_spinlock/ck_hclh.h +++ b/regressions/ck_spinlock/ck_hclh.h @@ -10,7 +10,7 @@ static ck_spinlock_hclh_t CK_CC_CACHELINE *local_lock[CORES / 2] #define LOCK_STATE ck_spinlock_hclh_t *na = malloc(MAX(sizeof(ck_spinlock_hclh_t), 64)) -#define LOCK ck_spinlock_hclh_lock(&glob_lock, &local_lock[(core % CORES) / 2], na) +#define LOCK ck_spinlock_hclh_lock(&glob_lock, &local_lock[core % (CORES / 2)], na) #define UNLOCK ck_spinlock_hclh_unlock(&na) #define LOCK_INIT do { \ int _i; \