Skip to content

Commit

Permalink
iouring: remove RLIMIT_MEMLOCK check for new kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
beef9999 committed Jan 11, 2024
1 parent 49a2710 commit bd08579
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.linux.x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ jobs:

container:
image: dokken/centos-stream-8:sha-40294ce
# In order to run io_uring, the docker daemon should add --default-ulimit memlock=-1:-1
options: --cpus 4

steps:
Expand Down Expand Up @@ -116,6 +115,5 @@ jobs:
- name: Test
run: |
cd build
ulimit -l unlimited
export PHOTON_CI_EV_ENGINE=io_uring
ctest --timeout 3600 -V
10 changes: 7 additions & 3 deletions io/iouring-wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ class iouringEngine : public MasterEventEngine, public CascadingEventEngine, pub
}

int init() {
rlimit resource_limit{.rlim_cur = RLIM_INFINITY, .rlim_max = RLIM_INFINITY};
if (setrlimit(RLIMIT_MEMLOCK, &resource_limit) != 0) {
LOG_ERROR_RETURN(0, -1, "iouring: failed to set resource limit. Use command `ulimit -l unlimited`, or change to root");
int compare_result;
if (kernel_version_compare("5.11", compare_result) == 0 && compare_result <= 0) {
rlimit resource_limit{.rlim_cur = RLIM_INFINITY, .rlim_max = RLIM_INFINITY};
if (setrlimit(RLIMIT_MEMLOCK, &resource_limit) != 0)
LOG_ERROR_RETURN(0, -1, "iouring: failed to set resource limit. "
"Use command `ulimit -l unlimited`, or change to root");
}

check_register_file_support();
check_cooperative_task_support();
set_submit_wait_function();
Expand Down

0 comments on commit bd08579

Please sign in to comment.