io: fix really slow dio_sparse on certain systems
PATCH 1/1 io: fix really slow dio_sparse on certain systems
From: Andrea Cervesato <[email protected]>
The reason why dio_sparse is happening to be slow on certain systems is that, if data buffering is slow, we run more buffered read() for one single dio write(). This slows down the whole test, because for each read() we always need to move data from kernel space to user space.
Create a READ_BUFFER_SIZE variable inside the common.h header and use it to define the write buffer size.
--- testcases/kernel/io/ltp-aiodio/common.h | 6 ++++-- testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
testcases/kernel/io/ltp-aiodio/common.h +4 -2
@@ -9,6 +9,8 @@#include <stdlib.h> #include "tst_test.h" +#define READ_BUFFER_SIZE 4096 +static inline char *check_zero (char *buf,int size) {char *p;
@@ -57,7 +59,7 @@ static inline void io_append(const char *path, char pattern, int flags, size_t bstatic inline void io_read (const char *filename,int filesize,volatile int *run_child) { -char buff[4096 ]; +char buff[READ_BUFFER_SIZE ];int fd;int i;int r;
@@ -102,7 +104,7 @@ exit:static inline void io_read_eof (const char *filename,volatile int *run_child) { -char buff[4096 ]; +char buff[READ_BUFFER_SIZE ];int fd;int r;
testcases/kernel/io/ltp-aiodio/dio_sparse.c +1 -1
@@ -32,7 +32,7 @@ static char *str_filesize;static char *str_offset;static int numchildren =16 ; -static long long writesize =1024 ; +static long long writesize =READ_BUFFER_SIZE ;static long long filesize =100 *1024 *1024 ;static long long offset =0 ;static long long alignment;
---
base-commit: c47ab95d5fe077133e598ac7762387450a87cb2b
change-id: 20260123-fix_dio_sparse_slow-925958767d74
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Andrea,
Quoted 7 lines
The reason why
dio_sparseis happening to be slow on certain systems is that, if data buffering is slow, we run more bufferedread()for one single diowrite(). This slows down the whole test, because for eachread()we always need to move data from kernel space to user space.Create a
READ_BUFFER_SIZEvariable inside thecommon.hheader and use it to define the write buffer size.
LGTM. IMHO good for a release.
Kind regards,
Petr
Quoted 50 lines
Signed-off-by Andrea Cervesato <[email protected]>--- testcases/kernel/io/ltp-aiodio/common.h | 6 ++++-- testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)testcases/kernel/io/ltp-aiodio/common.h +4
-2@@ -9,6 +9,8 @@#include <stdlib.h> #include "tst_test.h" +#define READ_BUFFER_SIZE 4096 +static inline char *check_zero (char *buf,int size) {char *p;@@ -57,7 +59,7 @@ static inline void io_append(const char *path, char pattern, int flags, size_t bstatic inline void io_read (const char *filename,int filesize,volatile int *run_child) { -char buff[4096 ]; +char buff[READ_BUFFER_SIZE ];int fd;int i;int r;@@ -102,7 +104,7 @@ exit:static inline void io_read_eof (const char *filename,volatile int *run_child) { -char buff[4096 ]; +char buff[READ_BUFFER_SIZE ];int fd;int r;testcases/kernel/io/ltp-aiodio/dio_sparse.c +1
-1@@ -32,7 +32,7 @@ static char *str_filesize;static char *str_offset;static int numchildren =16 ; -static long long writesize =1024 ; +static long long writesize =READ_BUFFER_SIZE ;static long long filesize =100 *1024 *1024 ;static long long offset =0 ;static long long alignment;
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 3 lines
LGTM. IMHO good for a release.
Should I merge it with your review tag? I also noticed that I forgot to update the default value in the test options. I send v2, then we should merge it if possible because this issue causes test to complete in 4 hours on certain systems.
King regards,
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 10 lines
Hi!
Quoted 1 line
LGTM. IMHO good for a release.
Should I merge it with your review tag? I also noticed that I forgot to update the default value in the test options. I send v2, then we should merge it if possible because this issue causes test to complete in 4 hours on certain systems.
+1. Please Cc me, I'll add my RBT in v2.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 11 lines · Petr Vorel
Quoted 10 lines
Hi!
Quoted 1 line
LGTM. IMHO good for a release.
Should I merge it with your review tag? I also noticed that I forgot to update the default value in the test options. I send v2, then we should merge it if possible because this issue causes test to complete in 4 hours on certain systems.
Quoted 4 lines
+1. Please Cc me, I'll add my RBT in v2.
Kind regards,
Petr
Sorry that was sent already without CC, you can find it in the ML.
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp