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
Fix constraint detection in the GC #51656
base: master
Are you sure you want to change the base?
Conversation
if (constrained_mem > 0 && constrained_mem < total_mem) | ||
uint64_t constrained_mem = uv_get_constrained_memory(); // This returns != 0 for not constrained | ||
int constrained = constrained_mem != 0 ? 1 : 0; // But it can return -1 if there is a constraint but no value | ||
constrained_mem = (total_mem < constrained) ? total_mem : constrained_mem; // The constrained value can also be greater so take the min |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constrained_mem = (total_mem < constrained) ? total_mem : constrained_mem; // The constrained value can also be greater so take the min | |
constrained_mem = constrained_mem * 4 / 3; // n.b. the user constraint might be larger than the `uv_get_total_memory` value. Try to fill no more than 75% of that constraint with GC pages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know that this is exactly a "fix", since the behavior before was not wrong, but possibly also not intended. However, I don't think either is correct. The constraint is just the cgroup, it doesn't make sense to me to arbitrarily take the minimum with a different value and create an unnecessary constraint with that, which was neither present before nor requested by the user.
So my goal is to detect if we have a constraint, and if so respect it. Though if we have a constraint that doesn't have a set value (like GHA does) we probably want to follow the max physical memory at least (GHA does set it). Though we might want to make a bit fancier and do something like. If it's uintmax, then follow max physical, otherwise follow the constraint set? |
We should probably respect |
to the constraint instead of a fixed amount.
About the |
Sure. make a PR? |
This wasn't respecting the documentation that Libuv has, which lead to weird results. This might have caused some issues with julia inside containers