diff --git a/.github/workflows/ci.linux.x86.yml b/.github/workflows/ci.linux.x86.yml index d19e377b..b0101a2b 100644 --- a/.github/workflows/ci.linux.x86.yml +++ b/.github/workflows/ci.linux.x86.yml @@ -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: @@ -116,6 +115,5 @@ jobs: - name: Test run: | cd build - ulimit -l unlimited export PHOTON_CI_EV_ENGINE=io_uring ctest --timeout 3600 -V diff --git a/io/iouring-wrapper.cpp b/io/iouring-wrapper.cpp index 77579daa..ab3aadd1 100644 --- a/io/iouring-wrapper.cpp +++ b/io/iouring-wrapper.cpp @@ -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();