* [PATCH] rt-tests: oslat: Allocate memory for cpu_set
@ 2021-02-12 17:29 John Kacur
2021-02-12 17:33 ` Daniel Wagner
0 siblings, 1 reply; 3+ messages in thread
From: John Kacur @ 2021-02-12 17:29 UTC (permalink / raw)
To: RT
Cc: Daniel Wagner, Clark Williams, Peter Xu, Pradipta Kumar Sahoo,
John Kacur
- cpu_set is a pointer to a bitmask struct
Memory needs to be allocated for the struct, so call
numa_allocate_cpumask()
- use rt-tests fatal to exit on error conditions
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/oslat/oslat.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 2fe550b3ee12..2a3be393a268 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -727,6 +727,10 @@ int main(int argc, char *argv[])
exit(1);
}
+ cpu_set = numa_allocate_cpumask();
+ if (!cpu_set)
+ fatal("oslat: Could not allocate cpumask\n");
+
g.app_name = argv[0];
g.rtprio = 0;
g.bucket_size = BUCKET_SIZE;
@@ -742,8 +746,9 @@ int main(int argc, char *argv[])
if (!g.cpu_list)
g.cpu_list = strdup("all");
- if (parse_cpumask(g.cpu_list, max_cpus, &cpu_set))
- exit(1);
+
+ if (parse_cpumask(g.cpu_list, max_cpus, &cpu_set) != 0)
+ fatal("oslat: parse_cpumask failed.\n");
n_cores = numa_bitmask_weight(cpu_set);
TEST(threads = calloc(1, n_cores * sizeof(threads[0])));
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rt-tests: oslat: Allocate memory for cpu_set
2021-02-12 17:29 [PATCH] rt-tests: oslat: Allocate memory for cpu_set John Kacur
@ 2021-02-12 17:33 ` Daniel Wagner
2021-02-12 18:14 ` John Kacur
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Wagner @ 2021-02-12 17:33 UTC (permalink / raw)
To: John Kacur; +Cc: RT, Clark Williams, Peter Xu, Pradipta Kumar Sahoo
On Fri, Feb 12, 2021 at 12:29:13PM -0500, John Kacur wrote:
> - cpu_set is a pointer to a bitmask struct
> Memory needs to be allocated for the struct, so call
> numa_allocate_cpumask()
>
> - use rt-tests fatal to exit on error conditions
>
> Signed-off-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rt-tests: oslat: Allocate memory for cpu_set
2021-02-12 17:33 ` Daniel Wagner
@ 2021-02-12 18:14 ` John Kacur
0 siblings, 0 replies; 3+ messages in thread
From: John Kacur @ 2021-02-12 18:14 UTC (permalink / raw)
To: Daniel Wagner; +Cc: RT, Clark Williams, Peter Xu, Pradipta Kumar Sahoo
On Fri, 12 Feb 2021, Daniel Wagner wrote:
> On Fri, Feb 12, 2021 at 12:29:13PM -0500, John Kacur wrote:
> > - cpu_set is a pointer to a bitmask struct
> > Memory needs to be allocated for the struct, so call
> > numa_allocate_cpumask()
> >
> > - use rt-tests fatal to exit on error conditions
> >
> > Signed-off-by: John Kacur <jkacur@redhat.com>
>
> Reviewed-by: Daniel Wagner <dwagner@suse.de>
>
Thanks. I added your Reviewed-by and pushed the three oslat fixes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-12 18:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 17:29 [PATCH] rt-tests: oslat: Allocate memory for cpu_set John Kacur
2021-02-12 17:33 ` Daniel Wagner
2021-02-12 18:14 ` John Kacur
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).