From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88B0A41DAF; Thu, 2 Mar 2023 01:48:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B825142B8B; Thu, 2 Mar 2023 01:48:07 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C248140EE3 for ; Thu, 2 Mar 2023 01:48:02 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0FF42209FE12; Wed, 1 Mar 2023 16:48:01 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0FF42209FE12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1677718082; bh=Q26ZsikVWyZYf9icOLt0Erhc1HuvuvZ81/0zXAW006w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kLAVB/G1+CcNs87UCLj/fY/wwiTpOk8yKVy4SoLIrJlRphCqX7iDF+hK2TpcHIeZU RnRCMkdkljvOUFbiqJH/b433TW7Py/HszP7k6fFHIiuDE6brQP9Lrer1y5orcK+Ee0 DvN0g8AcFf1fk2FxTP1tAS7nFwZqeCv8VGD9yZtA= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH 03/17] stack: use previous value atomic fetch operations Date: Wed, 1 Mar 2023 16:47:34 -0800 Message-Id: <1677718068-2412-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1677718068-2412-1-git-send-email-roretzla@linux.microsoft.com> References: <1677718068-2412-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Use __atomic_fetch_{add,and,or,sub,xor} instead of __atomic_{add,and,or,sub,xor}_fetch when we have no interest in the result of the operation. Reduces unnecessary codegen that provided the result of the atomic operation that was not used. Change brings closer alignment with atomics available in C11 standard and will reduce review effort when they are integrated. Signed-off-by: Tyler Retzlaff --- lib/stack/rte_stack_lf_c11.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stack/rte_stack_lf_c11.h b/lib/stack/rte_stack_lf_c11.h index 8403196..687a6f6 100644 --- a/lib/stack/rte_stack_lf_c11.h +++ b/lib/stack/rte_stack_lf_c11.h @@ -66,7 +66,7 @@ /* Ensure the stack modifications are not reordered with respect * to the LIFO len update. */ - __atomic_add_fetch(&list->len, num, __ATOMIC_RELEASE); + __atomic_fetch_add(&list->len, num, __ATOMIC_RELEASE); } static __rte_always_inline struct rte_stack_lf_elem * -- 1.8.3.1