-
Notifications
You must be signed in to change notification settings - Fork 260
/proc/pressure/{cpu, io, memory} virtualization #691
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
This change is safe, cause I'm adding a union and we have enough space for void *. Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Define SIG_NOTIFY_POLL_WAKEUP as SIGRTMIN + 0 and install noop signal handler. This signal will be used to manage notification threads. Signed-off-by: Alexander Mikhalitsyn <[email protected]>
341c174 to
ee484b2
Compare
Virtualize /proc/pressure/{cpu, io, memory} by doing a simple
passthrough of write()/poll() syscalls to the underlying cgroup's
/sys/fs/cgroup/x/y/z/{cpu, io, memory}.pressure file.
Implementation is a bit tricky because FUSE notifications must
be issued asynchroniously and we have to use a separate thread for this.
My main concern here was to ensure that no thread leaks are possible,
cause it can be a potenial DoS for host.
If PSITRIGGERTEST macro is defined, then instead of poll-ing on a real
fd we do a simple nanosleep() with 1 second delay. This needed to enable
CI testing of this feature.
For a "real-world" testing, I was using an example program from [1],
but with cpu counter instead of memory. To make cpu pressure I use
"sysbench --threads="$(nproc)" cpu run" command.
Link: https://www.kernel.org/doc/Documentation/accounting/psi.rst [1]
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
4600fb5 to
4b3921f
Compare
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
4b3921f to
39e4724
Compare
Let's make PSI triggers virtulization opt-in feature. Signed-off-by: Alexander Mikhalitsyn <[email protected]>
brauner
approved these changes
Nov 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Virtualize /proc/pressure/{cpu, io, memory} by doing a simple
passthrough of write()/poll() syscalls to the underlying cgroup's
/sys/fs/cgroup/x/y/z/{cpu, io, memory}.pressure file.
Implementation is a bit tricky because FUSE notifications must
be issued asynchroniously and we have to use a separate thread for this.
My main concern here was to ensure that no thread leaks are possible,
cause it can be a potenial DoS for host.
If PSITRIGGERTEST macro is defined, then instead of poll-ing on a real
fd we do a simple nanosleep() with 3 seconds delay. This needed to enable
CI testing of this feature.
For a "real-world" testing, I was using an example program from [1],
but with cpu counter instead of memory. To make cpu pressure I use
"sysbench --threads="$(nproc)" cpu run" command.
Link: https://www.kernel.org/doc/Documentation/accounting/psi.rst [1]