Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iouring: remove RLIMIT_MEMLOCK check for new kernel #325

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

beef9999
Copy link
Collaborator

io_uring accounts memory it needs under the rlimit memlocked option, which
can be quite low on some setups (64K). The default is usually enough for
most use cases, but bigger rings or things like registered buffers deplete
it quickly. This affects 5.11 and earlier, new kernels are less dependent
on RLIMIT_MEMLOCK as it is only used for registering buffers.

@beef9999 beef9999 requested a review from lihuiba January 10, 2024 06:24
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. "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is ERROR_RETURN absolutely needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we need to set a value, and we have no idea what's the appropriate number, based on the ring size.

So a strong check makes things easier, and let users know in advance.

@beef9999 beef9999 merged commit bd08579 into release/0.7 Jan 11, 2024
7 checks passed
@lihuiba lihuiba deleted the beef9999/minor-15 branch January 16, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants