[PATCH] rt-tests: oslat: Allocate memory for cpu_set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- 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@xxxxxxxxxx>
---
 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




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux