Skip to content

Commit eeb0df2

Browse files
committed
x509storeissuer: count the iterations in a local variable to avoid hammering the common counts array's cache line
Signed-off-by: Eugene Syromiatnikov <[email protected]>
1 parent 7b75fc3 commit eeb0df2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

source/x509storeissuer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,14 @@ do_x509storeissuer(size_t num)
147147
X509_STORE_CTX *ctx = X509_STORE_CTX_new();
148148
X509 *issuer = NULL;
149149
OSSL_TIME time = ossl_time_now();
150+
size_t count = 0;
150151

151152
if (ctx == NULL || !X509_STORE_CTX_init(ctx, store, x509_nonce, NULL)) {
152153
warnx("Failed to initialise X509_STORE_CTX");
153154
error = 1;
154155
goto err;
155156
}
156157

157-
counts[num] = 0;
158-
159158
do {
160159
/*
161160
* We actually expect this to fail. We've not configured any
@@ -169,13 +168,15 @@ do_x509storeissuer(size_t num)
169168
goto err;
170169
}
171170
issuer = NULL;
172-
counts[num]++;
171+
count++;
173172
if ((count & 0x3f) == 0)
174173
time = ossl_time_now();
175174
} while (time.t < max_time.t);
176175

177176
err:
178177
X509_STORE_CTX_free(ctx);
178+
179+
counts[num] = count;
179180
}
180181

181182
static void

0 commit comments

Comments
 (0)