From a0639afe121870a2a9b69cadc07619ba82959e3e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 17 Feb 2022 10:18:49 -0700 Subject: [PATCH] t/io_uring: align buffers correctly on non-4k page sizes Signed-off-by: Jens Axboe --- t/io_uring.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/io_uring.c b/t/io_uring.c index 40021647..f513d7dc 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -1156,6 +1156,7 @@ int main(int argc, char *argv[]) struct submitter *s; unsigned long done, calls, reap; int err, i, j, flags, fd, opt, threads_per_f, threads_rem = 0, nfiles; + long page_size; struct file f; char *fdepths; void *ret; @@ -1319,12 +1320,16 @@ int main(int argc, char *argv[]) arm_sig_int(); + page_size = sysconf(_SC_PAGESIZE); + if (page_size < 0) + page_size = 4096; + for (j = 0; j < nthreads; j++) { s = get_submitter(j); for (i = 0; i < roundup_pow2(depth); i++) { void *buf; - if (posix_memalign(&buf, bs, bs)) { + if (posix_memalign(&buf, page_size, bs)) { printf("failed alloc\n"); return 1; } -- 2.25.1