Skip to contentSkip to conversation

dma_thread_diotest: Correct the number of running workers

PATCH New Dong Zhu 2 participants 2 messages Jun 2, 2016 – Jun 3, 2016

lore
Share & tools
lore

Dong Zhu

author
#0 lore raw

PATCH 1/1 dma_thread_diotest: Correct the number of running workers

This test will cause Segmentation fault (core dumped) in a system with 20 CPUs and memory PAGESIZE is 64KB. Because for a 1MB buffer which could admit 1MB/PAGESIZE workers at most.

So the purpose of this patch is correcting the number of running workers in terms of actual PAGESIZE.

---
 testcases/kernel/io/direct_io/dma_thread_diotest.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
testcases/kernel/io/direct_io/dma_thread_diotest.c +6 -4
index 39cf658..5f52dcc 100644
@@ -113,10 +113,10 @@
 #define DIR_MODE	(S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP| \
 			 S_IXGRP|S_IROTH|S_IXOTH)
 #define FILECOUNT	100
-#define MIN_WORKERS	2
-#define MAX_WORKERS	256
 #define PATTERN		(0xfa)
 #define PAGE_SIZE	getpagesize()
+#define MIN_WORKERS	2
+#define MAX_WORKERS	(READSIZE/PAGE_SIZE)
 
 char *TCID = "dma_thread_diotest";
 int TST_TOTAL = 1;
@@ -229,6 +229,8 @@ int main(int argc, char *argv[])
 	int i, lc;
 
 	workers = sysconf(_SC_NPROCESSORS_ONLN);
+	if (workers > MAX_WORKERS)
+		workers = MAX_WORKERS;
 	tst_parse_opts(argc, argv, options, help);
 
 	setup();
@@ -439,6 +441,6 @@ static void cleanup(void)
 static void help(void)
 {
 	printf("-a align read buffer to offset <alignment>.\n");
-	printf("-w number of worker threads, 2 (default) to 256,"
-	       " defaults to number of cores.\n");
+	printf("-w number of worker threads, 2 (default) to %d,"
+	       " defaults to number of cores.\n", MAX_WORKERS);
 }
Signature · 6 lines
2.1.0


-- 
Best Regards,
Dong Zhu
#1 lore raw

PATCH 1/1 dma_thread_diotest: Correct the number of running workers

----- Original Message -----

Quoted 10 lines

From: "Dong Zhu" <[email protected]>
To: [email protected]
Sent: Thursday, 2 June, 2016 3:58:31 PM
Subject: [LTP] [PATCH] dma_thread_diotest: Correct the number of running workers

This test will cause Segmentation fault (core dumped) in a system with 20 CPUs and memory PAGESIZE is 64KB. Because for a 1MB buffer which could admit 1MB/PAGESIZE workers at most.

Quoted 4 lines

So the purpose of this patch is correcting the number of running workers in terms of actual PAGESIZE.

I have slightly modified commit log and pushed.

Thanks,
Jan

Quoted 51 lines
---
 testcases/kernel/io/direct_io/dma_thread_diotest.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
testcases/kernel/io/direct_io/dma_thread_diotest.c +6 -5
index 39cf658..5f52dcc 100644
@@ -113,10 +113,10 @@
 #define DIR_MODE	(S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP| \
 			 S_IXGRP|S_IROTH|S_IXOTH)
 #define FILECOUNT	100
-#define MIN_WORKERS	2
-#define MAX_WORKERS	256
 #define PATTERN		(0xfa)
 #define PAGE_SIZE	getpagesize()
+#define MIN_WORKERS	2
+#define MAX_WORKERS	(READSIZE/PAGE_SIZE)
 
 char *TCID = "dma_thread_diotest";
 int TST_TOTAL = 1;
@@ -229,6 +229,8 @@ int main(int argc, char *argv[])
 	int i, lc;
 
 	workers = sysconf(_SC_NPROCESSORS_ONLN);
+	if (workers > MAX_WORKERS)
+		workers = MAX_WORKERS;
 	tst_parse_opts(argc, argv, options, help);
 
 	setup();
@@ -439,6 +441,6 @@ static void cleanup(void)
 static void help(void)
 {
 	printf("-a align read buffer to offset <alignment>.\n");
-	printf("-w number of worker threads, 2 (default) to 256,"
-	       " defaults to number of cores.\n");
+	printf("-w number of worker threads, 2 (default) to %d,"
+	       " defaults to number of cores.\n", MAX_WORKERS);
 }
--

2.1.0

--
Best Regards,
Dong Zhu

--
Mailing list info: https://lists.linux.it/listinfo/ltp