From: Phil Yang <phil.yang@arm.com>
To: dev@dpdk.org, thomas@monjalon.net
Cc: david.hunt@intel.com, reshma.pattan@intel.com, gavin.hu@arm.com,
honnappa.nagarahalli@arm.com, phil.yang@arm.com, nd@arm.com
Subject: [dpdk-dev] [PATCH v4 3/3] test/ring_perf: replace sync builtins with atomic builtins
Date: Mon, 8 Apr 2019 11:02:31 +0800 [thread overview]
Message-ID: <1554692551-28275-4-git-send-email-phil.yang@arm.com> (raw)
Message-ID: <20190408030231.do2gmVzVxikkSCfySBesAP5nQL8l05XyVnG7Kqmijmc@z> (raw)
In-Reply-To: <1554692551-28275-1-git-send-email-phil.yang@arm.com>
In-Reply-To: <1546508946-12552-1-git-send-email-phil.yang@arm.com>
'__sync' built-in functions are deprecated, should use the '__atomic'
built-in instead. the sync built-in functions are full barriers, while
atomic built-in functions offer less restrictive one-way barriers,
which help performance.
Here is the example test result on TX2:
sudo ./arm64-armv8a-linuxapp-gcc/app/test -c 0x7fffffe \
-n 4 --socket-mem=1024,0 --file-prefix=~ -- -i
RTE>>ring_perf_autotest
*** ring_perf_autotest without this patch ***
SP/SC bulk enq/dequeue (size: 8): 6.22
MP/MC bulk enq/dequeue (size: 8): 11.50
SP/SC bulk enq/dequeue (size: 32): 1.85
MP/MC bulk enq/dequeue (size: 32): 2.66
*** ring_perf_autotest with this patch ***
SP/SC bulk enq/dequeue (size: 8): 6.13
MP/MC bulk enq/dequeue (size: 8): 9.83
SP/SC bulk enq/dequeue (size: 32): 1.96
MP/MC bulk enq/dequeue (size: 32): 2.30
So for the ring performance test, this patch improved 11% of ring
operations performance.
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
---
app/test/test_ring_perf.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c
index ebb3939..e851c1a 100644
--- a/app/test/test_ring_perf.c
+++ b/app/test/test_ring_perf.c
@@ -160,7 +160,11 @@ enqueue_bulk(void *p)
unsigned i;
void *burst[MAX_BURST] = {0};
- if ( __sync_add_and_fetch(&lcore_count, 1) != 2 )
+#ifdef RTE_USE_C11_MEM_MODEL
+ if (__atomic_add_fetch(&lcore_count, 1, __ATOMIC_RELAXED) != 2)
+#else
+ if (__sync_add_and_fetch(&lcore_count, 1) != 2)
+#endif
while(lcore_count != 2)
rte_pause();
@@ -196,7 +200,11 @@ dequeue_bulk(void *p)
unsigned i;
void *burst[MAX_BURST] = {0};
- if ( __sync_add_and_fetch(&lcore_count, 1) != 2 )
+#ifdef RTE_USE_C11_MEM_MODEL
+ if (__atomic_add_fetch(&lcore_count, 1, __ATOMIC_RELAXED) != 2)
+#else
+ if (__sync_add_and_fetch(&lcore_count, 1) != 2)
+#endif
while(lcore_count != 2)
rte_pause();
--
2.7.4
next prev parent reply other threads:[~2019-04-08 3:01 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 9:49 [dpdk-dev] [PATCH] packet_ordering: " Phil Yang
2019-03-28 18:42 ` Thomas Monjalon
2019-03-28 18:42 ` Thomas Monjalon
2019-03-29 1:34 ` Phil Yang (Arm Technology China)
2019-03-29 1:34 ` Phil Yang (Arm Technology China)
2019-03-29 10:56 ` [dpdk-dev] [PATCH v2 0/3] example and test cases optimizations Phil Yang
2019-03-29 10:56 ` Phil Yang
2019-03-29 10:56 ` [dpdk-dev] [PATCH v2 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-03-29 10:56 ` Phil Yang
2019-03-29 16:39 ` Pattan, Reshma
2019-03-29 16:39 ` Pattan, Reshma
2019-03-30 16:55 ` Phil Yang (Arm Technology China)
2019-03-30 16:55 ` Phil Yang (Arm Technology China)
2019-04-01 12:58 ` Pattan, Reshma
2019-04-01 12:58 ` Pattan, Reshma
2019-04-02 3:33 ` Phil Yang (Arm Technology China)
2019-04-02 3:33 ` Phil Yang (Arm Technology China)
2019-03-29 10:56 ` [dpdk-dev] [PATCH v2 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-03-29 10:56 ` Phil Yang
2019-04-01 16:24 ` Honnappa Nagarahalli
2019-04-01 16:24 ` Honnappa Nagarahalli
2019-04-02 3:43 ` Phil Yang (Arm Technology China)
2019-04-02 3:43 ` Phil Yang (Arm Technology China)
2019-03-29 10:56 ` [dpdk-dev] [PATCH v2 3/3] test/ring_perf: " Phil Yang
2019-03-29 10:56 ` Phil Yang
2019-04-01 16:24 ` Honnappa Nagarahalli
2019-04-01 16:24 ` Honnappa Nagarahalli
2019-04-03 6:59 ` [dpdk-dev] [PATCH v3 0/3] example and test cases optimizations Phil Yang
2019-04-03 6:59 ` Phil Yang
2019-04-03 6:59 ` [dpdk-dev] [PATCH v3 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-04-03 6:59 ` Phil Yang
2019-04-04 23:24 ` Thomas Monjalon
2019-04-04 23:24 ` Thomas Monjalon
2019-04-08 4:04 ` Phil Yang (Arm Technology China)
2019-04-08 4:04 ` Phil Yang (Arm Technology China)
2019-04-03 6:59 ` [dpdk-dev] [PATCH v3 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-04-03 6:59 ` Phil Yang
2019-04-04 15:30 ` Honnappa Nagarahalli
2019-04-04 15:30 ` Honnappa Nagarahalli
2019-04-03 6:59 ` [dpdk-dev] [PATCH v3 3/3] test/ring_perf: " Phil Yang
2019-04-03 6:59 ` Phil Yang
2019-04-08 3:02 ` [dpdk-dev] [PATCH v4 0/3] example and test cases optimizations Phil Yang
2019-04-08 3:02 ` Phil Yang
2019-07-04 20:15 ` Thomas Monjalon
2019-07-05 3:19 ` Phil Yang (Arm Technology China)
2019-07-08 14:38 ` Thomas Monjalon
2019-04-08 3:02 ` [dpdk-dev] [PATCH v4 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-04-08 3:02 ` Phil Yang
2019-04-08 3:02 ` [dpdk-dev] [PATCH v4 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-04-08 3:02 ` Phil Yang
2019-04-10 14:05 ` Hunt, David
2019-04-10 14:05 ` Hunt, David
2019-04-11 11:31 ` Phil Yang (Arm Technology China)
2019-04-11 11:31 ` Phil Yang (Arm Technology China)
2019-04-08 3:02 ` Phil Yang [this message]
2019-04-08 3:02 ` [dpdk-dev] [PATCH v4 3/3] test/ring_perf: " Phil Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1554692551-28275-4-git-send-email-phil.yang@arm.com \
--to=phil.yang@arm.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=gavin.hu@arm.com \
--cc=honnappa.nagarahalli@arm.com \
--cc=nd@arm.com \
--cc=reshma.pattan@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).