From 4dbf07af51e2b560c379324a7551dd247bb52de4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 15 Dec 2022 20:52:43 +0000 Subject: use uatomic_inc where appropriate It's slightly more readable IMHO, and perhaps it generates better code on x86 (since URCU has x86-specific paths for it). --- mwrap_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mwrap_core.h b/mwrap_core.h index 4dc28d4..d798b79 100644 --- a/mwrap_core.h +++ b/mwrap_core.h @@ -280,7 +280,7 @@ again: l = src_loc_get(t, k); if (l) { uatomic_add(&l->total, k->total); - uatomic_add(&l->allocations, 1); + uatomic_inc(&l->allocations); } else { size_t n = bt_bytelen(k) + sizeof(*k); struct cds_lfht_node *cur; @@ -462,7 +462,7 @@ void free(void *p) uatomic_add(&total_bytes_dec, h->size); uatomic_add(&l->freed_bytes, h->size); uatomic_set(&h->size, 0); - uatomic_add(&l->frees, 1); + uatomic_inc(&l->frees); uatomic_add(&l->age_total, age); CHECK(int, 0, pthread_mutex_lock(l->mtx)); -- cgit v1.2.3-24-ge0c7