From: Jens Axboe Date: Wed, 8 Sep 2021 14:07:57 +0000 (-0600) Subject: t/io_uring: don't make setrlimit() failing fatal X-Git-Tag: fio-3.28~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=15130e3f8077d5ef5386a5311a6ea857a7cf206e;p=fio.git t/io_uring: don't make setrlimit() failing fatal We don't even need this on newer kernels, so just ignore it if it fails. The worst that can happen is that buffer registration will fail. Signed-off-by: Jens Axboe --- diff --git a/t/io_uring.c b/t/io_uring.c index 28c76b02..77d27859 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -468,6 +468,13 @@ static int setup_ring(struct submitter *s) io_uring_probe(fd); if (fixedbufs) { + struct rlimit rlim; + + rlim.rlim_cur = RLIM_INFINITY; + rlim.rlim_max = RLIM_INFINITY; + /* ignore potential error, not needed on newer kernels */ + setrlimit(RLIMIT_MEMLOCK, &rlim); + ret = io_uring_register_buffers(s); if (ret < 0) { perror("io_uring_register_buffers"); @@ -646,17 +653,6 @@ int main(int argc, char *argv[]) j = 0; } - if (fixedbufs) { - struct rlimit rlim; - - rlim.rlim_cur = RLIM_INFINITY; - rlim.rlim_max = RLIM_INFINITY; - if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0) { - perror("setrlimit"); - return 1; - } - } - arm_sig_int(); for (j = 0; j < nthreads; j++) {