From: John Kacur <jkacur@redhat.com>
To: RT <linux-rt-users@vger.kernel.org>, Daniel Wagner <dwagner@suse.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Kurt Kanzenbach <kurt.kanzenbach@linutronix.de>,
Clark Williams <williams@redhat.com>,
Christian Eggers <ceggers@arri.de>,
John Kacur <jkacur@redhat.com>
Subject: [PATCH 2/3] Revert "cyclictest: Always use libnuma"
Date: Fri, 19 Feb 2021 13:48:00 -0500 [thread overview]
Message-ID: <20210219184801.13905-3-jkacur@redhat.com> (raw)
In-Reply-To: <20210219184801.13905-1-jkacur@redhat.com>
This reverts commit 512d2b74561d5bdab15cacb7b1931cd0aa01d6b5.
libnuma is a buildtime requirement but not a runtime environment
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 63 ++++++++++++++++++++-----------------
src/cyclictest/rt_numa.h | 2 ++
2 files changed, 36 insertions(+), 29 deletions(-)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index e2753db39c02..3e31937f7088 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1018,6 +1018,9 @@ static void process_options(int argc, char *argv[], int max_cpus)
/* smp sets AFFINITY_USEALL in OPT_SMP */
if (smp)
break;
+ if (numa_initialize())
+ fatal("Couldn't initialize libnuma");
+ numa = 1;
if (optarg) {
parse_cpumask(optarg, max_cpus, &affinity_mask);
setaffinity = AFFINITY_SPECIFIED;
@@ -1126,6 +1129,8 @@ static void process_options(int argc, char *argv[], int max_cpus)
use_system = MODE_SYS_OFFSET; break;
case 'S':
case OPT_SMP: /* SMP testing */
+ if (numa)
+ fatal("numa and smp options are mutually exclusive\n");
smp = 1;
num_threads = -1; /* update after parsing */
setaffinity = AFFINITY_USEALL;
@@ -1199,17 +1204,16 @@ static void process_options(int argc, char *argv[], int max_cpus)
/* if smp wasn't requested, test for numa automatically */
if (!smp) {
+ if (numa_initialize())
+ fatal("Couldn't initialize libnuma");
+ numa = 1;
if (setaffinity == AFFINITY_UNSPECIFIED)
setaffinity = AFFINITY_USEALL;
}
- if (option_affinity && smp) {
- warn("-a ignored due to smp mode\n");
- if (affinity_mask) {
- numa_bitmask_free(affinity_mask);
- affinity_mask = NULL;
- }
- setaffinity = AFFINITY_USEALL;
+ if (option_affinity) {
+ if (smp)
+ warn("-a ignored due to smp mode\n");
}
if (smi) {
@@ -1778,12 +1782,6 @@ int main(int argc, char **argv)
int online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
int i, ret = -1;
int status;
- void *stack;
- void *currstk;
- size_t stksize;
-
- if (numa_initialize())
- fatal("Couldn't initialize libnuma");
process_options(argc, argv, max_cpus);
@@ -1972,27 +1970,34 @@ int main(int argc, char **argv)
default: cpu = -1;
}
- /* find the memory node associated with the cpu i */
- node = rt_numa_numa_node_of_cpu(cpu);
+ node = -1;
+ if (numa) {
+ void *stack;
+ void *currstk;
+ size_t stksize;
- /* get the stack size set for this thread */
- if (pthread_attr_getstack(&attr, &currstk, &stksize))
- fatal("failed to get stack size for thread %d\n", i);
+ /* find the memory node associated with the cpu i */
+ node = rt_numa_numa_node_of_cpu(cpu);
- /* if the stack size is zero, set a default */
- if (stksize == 0)
- stksize = PTHREAD_STACK_MIN * 2;
+ /* get the stack size set for this thread */
+ if (pthread_attr_getstack(&attr, &currstk, &stksize))
+ fatal("failed to get stack size for thread %d\n", i);
- /* allocate memory for a stack on appropriate node */
- stack = rt_numa_numa_alloc_onnode(stksize, node, cpu);
+ /* if the stack size is zero, set a default */
+ if (stksize == 0)
+ stksize = PTHREAD_STACK_MIN * 2;
- /* touch the stack pages to pre-fault them in */
- memset(stack, 0, stksize);
+ /* allocate memory for a stack on appropriate node */
+ stack = rt_numa_numa_alloc_onnode(stksize, node, cpu);
- /* set the thread's stack */
- if (pthread_attr_setstack(&attr, stack, stksize))
- fatal("failed to set stack addr for thread %d to 0x%x\n",
- i, stack+stksize);
+ /* touch the stack pages to pre-fault them in */
+ memset(stack, 0, stksize);
+
+ /* set the thread's stack */
+ if (pthread_attr_setstack(&attr, stack, stksize))
+ fatal("failed to set stack addr for thread %d to 0x%x\n",
+ i, stack+stksize);
+ }
/* allocate the thread's parameter block */
parameters[i] = par = threadalloc(sizeof(struct thread_param), node);
diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
index 87f5d3b66458..4cbd979c21e8 100644
--- a/src/cyclictest/rt_numa.h
+++ b/src/cyclictest/rt_numa.h
@@ -13,6 +13,8 @@
#include "rt-utils.h"
#include "rt-error.h"
+static int numa = 0;
+
#include <numa.h>
static void *
--
2.26.2
next prev parent reply other threads:[~2021-02-19 18:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-19 18:47 [PATCH 0/3] Revert always use libnuma patches John Kacur
2021-02-19 18:47 ` [PATCH 1/3] Revert "cyclictest: Use affinity_mask for steering thread placement" John Kacur
2021-02-19 18:48 ` John Kacur [this message]
2021-02-19 18:48 ` [PATCH 3/3] Revert "signaltest: Always use libnuma" John Kacur
2021-02-19 20:27 ` [PATCH 0/3] Revert always use libnuma patches Christian Eggers
2021-02-19 21:30 ` John Kacur
2021-02-22 8:25 ` Daniel Wagner
2021-02-22 22:10 ` John Kacur
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=20210219184801.13905-3-jkacur@redhat.com \
--to=jkacur@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=ceggers@arri.de \
--cc=dwagner@suse.de \
--cc=kurt.kanzenbach@linutronix.de \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.com \
/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).