Skip to content

Commit effd1b7

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 c7f19dc commit effd1b7

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
@@ -149,15 +149,14 @@ do_x509storeissuer(size_t num)
149149
X509_STORE_CTX *ctx = X509_STORE_CTX_new();
150150
X509 *issuer = NULL;
151151
OSSL_TIME time = ossl_time_now();
152+
size_t count = 0;
152153

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

159-
counts[num] = 0;
160-
161160
do {
162161
/*
163162
* We actually expect this to fail. We've not configured any
@@ -171,13 +170,15 @@ do_x509storeissuer(size_t num)
171170
goto err;
172171
}
173172
issuer = NULL;
174-
counts[num]++;
173+
count++;
175174
if ((count & 0x3f) == 0)
176175
time = ossl_time_now();
177176
} while (time.t < max_time.t);
178177

179178
err:
180179
X509_STORE_CTX_free(ctx);
180+
181+
counts[num] = count;
181182
}
182183

183184
static void

0 commit comments

Comments
 (0)