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

Use hard memory limit for EVE memory management. #4300

Merged

Conversation

OhmSpectator
Copy link
Member

Previously, EVE referenced the soft memory limit
(memory.soft_limit_in_bytes) to determine available memory for VM creation. By default, the soft and hard memory limits were set to the same value, so this did not cause any issues. However, if the soft and hard limits are configured differently, EVE would not respect the hard memory constraints, allowing VMs to be created without adhering to the intended maximum memory limits.

This commit updates the EveMemoryLimitFile path to use the hard memory limit (memory.limit_in_bytes) instead of the soft limit. By doing so, EVE will now properly account for the hard memory restrictions when managing memory for containers and creating new VMs, preventing potential memory overcommitment when soft and hard limits differ.

Thanks, @cperakis, for performing the test, which helped uncover it.

Previously, EVE referenced the soft memory limit
(`memory.soft_limit_in_bytes`) to determine available memory for VM
creation. By default, the soft and hard memory limits were set to the
same value, so this did not cause any issues. However, if the soft and
hard limits are configured differently, EVE would not respect the hard
memory constraints, allowing VMs to be created without adhering to the
intended maximum memory limits.

This commit updates the `EveMemoryLimitFile` path to use the hard memory
limit (`memory.limit_in_bytes`) instead of the soft limit. By doing so,
EVE will now properly account for the hard memory restrictions when
managing memory for containers and creating new VMs, preventing
potential memory overcommitment when soft and hard limits differ.

Signed-off-by: Nikolay Martyanov <[email protected]>
@OhmSpectator OhmSpectator added bug Something isn't working stable Should be backported to stable release(s) labels Sep 26, 2024
@OhmSpectator
Copy link
Member Author

And we also observed that EVE ignores the limit at all. It still uses 800M as the default memory requirement. We need to understand where it reads from.

@OhmSpectator OhmSpectator marked this pull request as draft September 26, 2024 16:20
@OhmSpectator
Copy link
Member Author

And we also observed that EVE ignores the limit at all. It still uses 800M as the default memory requirement. We need to understand where it reads from.

Nope. Everything is fine. But! We figured we could not use a limit of more than 0xffffffff.
It's a bit less than 4G. I'll document this restriction later.

@OhmSpectator OhmSpectator marked this pull request as ready for review September 26, 2024 17:22
Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

LGTM

@eriknordmark eriknordmark merged commit db4f3f3 into lf-edge:master Sep 27, 2024
53 of 56 checks passed
@OhmSpectator OhmSpectator deleted the fix/make-eve-use-hard-limit branch October 11, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stable Should be backported to stable release(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants