Skip to contentSkip to conversation

Reduce default number of threads in dio_sparse.c

PATCH In review Andrea Cervesato 3 participants 3 messages Jan 18, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Reduce default number of threads in dio_sparse.c

Initialized options out of setup and reduced default number of threads from 1000 to 16

---
 testcases/kernel/io/ltp-aiodio/dio_sparse.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
testcases/kernel/io/ltp-aiodio/dio_sparse.c +6 -12
index 929adbfba..8635df82f 100644
@@ -33,11 +33,11 @@ static char *str_writesize;
 static char *str_filesize;
 static char *str_offset;
 
-static int numchildren;
-static long long writesize;
-static long long filesize;
-static long long offset;
-static long long alignment;
+static int numchildren = 16;
+static long long writesize = 1024;
+static long long filesize = 100 * 1024 * 1024;
+static long long offset = 0;
+static long long alignment = 512;
 
 static void dio_sparse(int fd, int align, long long fs, int ws, long long off)
 {
@@ -60,12 +60,6 @@ static void setup(void)
 {
 	struct stat sb;
 
-	numchildren = 1000;
-	writesize = 1024;
-	filesize = 100 * 1024 * 1024;
-	offset = 0;
-	alignment = 512;
-
 	if (tst_parse_int(str_numchildren, &numchildren, 1, INT_MAX))
 		tst_brk(TBROK, "Invalid number of children '%s'", str_numchildren);
 
@@ -129,7 +123,7 @@ static struct tst_test test = {
 	.needs_tmpdir = 1,
 	.forks_child = 1,
 	.options = (struct tst_option[]) {
-		{"n:", &str_numchildren, "Number of threads (default 1000)"},
+		{"n:", &str_numchildren, "Number of threads (default 16)"},
 		{"w:", &str_writesize, "Size of writing blocks (default 1K)"},
 		{"s:", &str_filesize, "Size of file (default 100M)"},
 		{"o:", &str_offset, "File offset (default 0)"},
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi,
it'd have been better to move the defaults out of setup() in a separate commit let's push it as is this time.

Quoted 51 lines · Andrea Cervesato

Initialized options out of setup and reduced default number of threads from 1000 to 16

---
 testcases/kernel/io/ltp-aiodio/dio_sparse.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
testcases/kernel/io/ltp-aiodio/dio_sparse.c +6 -12
index 929adbfba..8635df82f 100644
@@ -33,11 +33,11 @@ static char *str_writesize;
 static char *str_filesize;
 static char *str_offset;
 
-static int numchildren;
-static long long writesize;
-static long long filesize;
-static long long offset;
-static long long alignment;
+static int numchildren = 16;
+static long long writesize = 1024;
+static long long filesize = 100 * 1024 * 1024;
+static long long offset = 0;
+static long long alignment = 512;
 
 static void dio_sparse(int fd, int align, long long fs, int ws, long long off)
 {
@@ -60,12 +60,6 @@ static void setup(void)
 {
 	struct stat sb;
 
-	numchildren = 1000;
-	writesize = 1024;
-	filesize = 100 * 1024 * 1024;
-	offset = 0;
-	alignment = 512;
-
 	if (tst_parse_int(str_numchildren, &numchildren, 1, INT_MAX))
 		tst_brk(TBROK, "Invalid number of children '%s'", str_numchildren);
 
@@ -129,7 +123,7 @@ static struct tst_test test = {
 	.needs_tmpdir = 1,
 	.forks_child = 1,
 	.options = (struct tst_option[]) {
-		{"n:", &str_numchildren, "Number of threads (default 1000)"},
+		{"n:", &str_numchildren, "Number of threads (default 16)"},
 		{"w:", &str_writesize, "Size of writing blocks (default 1K)"},
 		{"s:", &str_filesize, "Size of file (default 100M)"},
 		{"o:", &str_offset, "File offset (default 0)"},
Signature · 10 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Andrea Cervesato

Hi!

Quoted 2 lines

Initialized options out of setup and reduced default number of threads from 1000 to 16

I've added a bit more verbose descriptioin here about how the default has changed and pushed, thanks.

Quoted 13 lines
---
 testcases/kernel/io/ltp-aiodio/dio_sparse.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
testcases/kernel/io/ltp-aiodio/dio_sparse.c +0 -0
index 929adbfba..8635df82f 100644
@@ -33,11 +33,11 @@ static char *str_writesize;
 static char *str_filesize;
 static char *str_offset;
 

testcases/kernel/io/ltp-aiodio/dio_sparse.c static char *str_writesize; · line 40

Quoted 10 lines
testcases/kernel/io/ltp-aiodio/dio_sparse.c +5 -5
-static int numchildren;
-static long long writesize;
-static long long filesize;
-static long long offset;
-static long long alignment;
+static int numchildren = 16;
+static long long writesize = 1024;
+static long long filesize = 100 * 1024 * 1024;
+static long long offset = 0;
+static long long alignment = 512;

I've also removed this assignment since alignment is initialized unconditionally.

Quoted 30 lines
testcases/kernel/io/ltp-aiodio/dio_sparse.c +1 -7
 static void dio_sparse(int fd, int align, long long fs, int ws, long long off)
 {
@@ -60,12 +60,6 @@ static void setup(void)
 {
 	struct stat sb;
 
-	numchildren = 1000;
-	writesize = 1024;
-	filesize = 100 * 1024 * 1024;
-	offset = 0;
-	alignment = 512;
-
 	if (tst_parse_int(str_numchildren, &numchildren, 1, INT_MAX))
 		tst_brk(TBROK, "Invalid number of children '%s'", str_numchildren);
 
@@ -129,7 +123,7 @@ static struct tst_test test = {
 	.needs_tmpdir = 1,
 	.forks_child = 1,
 	.options = (struct tst_option[]) {
-		{"n:", &str_numchildren, "Number of threads (default 1000)"},
+		{"n:", &str_numchildren, "Number of threads (default 16)"},
 		{"w:", &str_writesize, "Size of writing blocks (default 1K)"},
 		{"s:", &str_filesize, "Size of file (default 100M)"},
 		{"o:", &str_offset, "File offset (default 0)"},
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis
[email protected]

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