Skip to contentSkip to conversation

test/file-verify.t: Don't run over mlock limit when run as non-root

PATCH Applied Gabriel Krisman Bertazi 2 participants 2 messages Apr 20, 2023 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/file-verify.t: Don't run over mlock limit when run as non-root

test/file-verify tries to get 2MB of pinned memory at once, which is higher than the default allowed for non-root users in older kernels (64kb before v5.16, nowadays 8mb). Skip the test for non-root users if the registration fails instead of failing the test.

---
 test/file-verify.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
test/file-verify.c +6 -2
index f33b24a..89cbb02 100644
@@ -381,9 +381,12 @@ static int test(struct io_uring *ring, const char *fname, int buffered,
 			v[i].iov_base = buf[i];
 			v[i].iov_len = CHUNK_SIZE;
 		}
-		ret = io_uring_register_buffers(ring, v, READ_BATCH);
+		ret = t_register_buffers(ring, v, READ_BATCH);
 		if (ret) {
-			fprintf(stderr, "Error buffer reg %d\n", ret);
+			if (ret == T_SETUP_SKIP) {
+				ret = 0;
+				goto free_bufs;
+			}
 			goto err;
 		}
 	}
@@ -477,6 +480,7 @@ static int test(struct io_uring *ring, const char *fname, int buffered,
 done:
 	if (registered)
 		io_uring_unregister_buffers(ring);
+free_bufs:
 	if (vectored) {
 		for (j = 0; j < READ_BATCH; j++)
 			for (i = 0; i < nr_vecs; i++)
Signature · 1 line
2.40.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Gabriel Krisman Bertazi

test/file-verify tries to get 2MB of pinned memory at once, which is higher than the default allowed for non-root users in older kernels (64kb before v5.16, nowadays 8mb). Skip the test for non-root users if the registration fails instead of failing the test.

Applied, thanks!

[1/1] test/file-verify.t: Don't run over mlock limit when run as non-root

      commit: b7f85996a5cb290fc2ad7d2f4d7341fc54321016

Best regards,

Signature · 1 line
Jens Axboe