]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
I was told to leave it alone, but I have this thing called OCD, you see 2433-lockless-mempool
authorOndřej Surý <ondrej@sury.org>
Wed, 3 Mar 2021 12:47:56 +0000 (13:47 +0100)
committerOndřej Surý <ondrej@sury.org>
Wed, 3 Mar 2021 14:32:01 +0000 (15:32 +0100)
lib/isc/mem.c

index 224cb5d71740ac9befc88aa263b61a6133a13ed9..a954441133e84a17af2a1eeb6097ba5a51d68177 100644 (file)
@@ -1320,13 +1320,10 @@ isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
 void *
 isc__mempool_get(isc_mempool_t *mpctx FLARG) {
        element *item = NULL;
-       unsigned int i;
 
        REQUIRE(VALID_MEMPOOL(mpctx));
        REQUIRE(isc_tid_v < mpctx->max_threads);
 
-       element *item;
-
        if (ISC_UNLIKELY(mpctx->items[isc_tid_v] == NULL)) {
                isc_mem_t *mctx = mpctx->mctx;
                item = mem_get(mctx, mpctx->size);
@@ -1358,13 +1355,12 @@ isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
        REQUIRE(mem != NULL);
        REQUIRE(isc_tid_v < mpctx->max_threads);
 
-       element *item;
        size_t allocated = atomic_fetch_sub_relaxed(&mpctx->allocated, 1);
        (void)atomic_fetch_add_relaxed(&mpctx->freecount[isc_tid_v], 1);
 
        INSIST(allocated > 0);
 
-       DELETE_TRACE(mctx, mem, mpctx->size, file, line);
+       DELETE_TRACE(mpctx->mctx, mem, mpctx->size, file, line);
 
        item = (element *)mem;
        item->next = mpctx->items[isc_tid_v];