Skip to content

Commit

Permalink
t/io_uring: only call setrlimit() for fixedbufs
Browse files Browse the repository at this point in the history
It's root only.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Jan 13, 2019
1 parent 934f42e commit b3ce355
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions t/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ int main(int argc, char *argv[])
struct submitter *s = &submitters[0];
unsigned long done, calls, reap, cache_hit, cache_miss;
int err, i, flags, fd;
struct rlimit rlim;
void *ret;

if (!do_nop && argc < 2) {
Expand Down Expand Up @@ -510,11 +509,15 @@ int main(int argc, char *argv[])
i++;
}

rlim.rlim_cur = RLIM_INFINITY;
rlim.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0) {
perror("setrlimit");
return 1;
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();
Expand Down

0 comments on commit b3ce355

Please sign in to comment.