From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: bluca@debian.org
Subject: [PATCH] test/lcores: reduce cpu consumption
Date: Thu, 7 Mar 2024 12:33:24 +0100 [thread overview]
Message-ID: <20240307113324.845309-1-david.marchand@redhat.com> (raw)
Busy looping on RTE_MAX_LCORES threads is too heavy in some CI
environments running the fast-test testsuite.
Ask for a reschedule at the threads synchronisation points.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Note: this is a quick patch with no validation, except that it runs fine
on my laptop.
Luca, can you check and see if it helps in your CI?
---
app/test/test_lcores.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c
index 22225a9fd3..7adc03d3da 100644
--- a/app/test/test_lcores.c
+++ b/app/test/test_lcores.c
@@ -2,6 +2,7 @@
* Copyright (c) 2020 Red Hat, Inc.
*/
+#include <sched.h>
#include <string.h>
#include <rte_common.h>
@@ -43,7 +44,7 @@ static uint32_t thread_loop(void *arg)
/* Wait for release from the control thread. */
while (__atomic_load_n(t->registered_count, __ATOMIC_ACQUIRE) != 0)
- ;
+ sched_yield();
rte_thread_unregister();
lcore_id = rte_lcore_id();
if (lcore_id != LCORE_ID_ANY) {
@@ -85,7 +86,7 @@ test_non_eal_lcores(unsigned int eal_threads_count)
/* Wait all non-EAL threads to register. */
while (__atomic_load_n(®istered_count, __ATOMIC_ACQUIRE) !=
non_eal_threads_count)
- ;
+ sched_yield();
/* We managed to create the max number of threads, let's try to create
* one more. This will allow one more check.
@@ -101,7 +102,7 @@ test_non_eal_lcores(unsigned int eal_threads_count)
printf("non-EAL threads count: %u\n", non_eal_threads_count);
while (__atomic_load_n(®istered_count, __ATOMIC_ACQUIRE) !=
non_eal_threads_count)
- ;
+ sched_yield();
}
skip_lcore_any:
@@ -267,7 +268,7 @@ test_non_eal_lcores_callback(unsigned int eal_threads_count)
non_eal_threads_count++;
while (__atomic_load_n(®istered_count, __ATOMIC_ACQUIRE) !=
non_eal_threads_count)
- ;
+ sched_yield();
if (l[0].init != eal_threads_count + 1 ||
l[1].init != eal_threads_count + 1) {
printf("Error: incorrect init calls, expected %u, %u, got %u, %u\n",
@@ -290,7 +291,7 @@ test_non_eal_lcores_callback(unsigned int eal_threads_count)
non_eal_threads_count++;
while (__atomic_load_n(®istered_count, __ATOMIC_ACQUIRE) !=
non_eal_threads_count)
- ;
+ sched_yield();
if (l[0].init != eal_threads_count + 2 ||
l[1].init != eal_threads_count + 2) {
printf("Error: incorrect init calls, expected %u, %u, got %u, %u\n",
--
2.44.0
next reply other threads:[~2024-03-07 11:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 11:33 David Marchand [this message]
2024-03-07 12:09 ` Luca Boccassi
2024-03-07 14:16 ` [PATCH v2] " David Marchand
2024-03-07 17:06 ` Stephen Hemminger
2024-03-07 17:08 ` Stephen Hemminger
2024-03-07 18:06 ` David Marchand
2024-03-07 18:36 ` Tyler Retzlaff
2024-03-07 19:25 ` Morten Brørup
2024-03-07 16:54 ` [PATCH] " Stephen Hemminger
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=20240307113324.845309-1-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bluca@debian.org \
--cc=dev@dpdk.org \
/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).