-
Notifications
You must be signed in to change notification settings - Fork 61
mrs: make quarantine overhead tunable #2376
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
Open
brooksdavis
wants to merge
4
commits into
dev
Choose a base branch
from
mrs-tunable-quarantine
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+79
−19
Conversation
This file contains 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
If defined at compile time, QUARANTINE_HIGHWATER limited the size of the quarantine to QUARANTINE_HIGHWATER bytes. Given the vast range of working set sizes this isn't particularly useful except perhaps to set it to 0. The environment variable _RUNTIME_REVOCATION_EVERY_FREE_ENABLE and associated sysctl now serves this purpose.
Use of this macro was removed with store-side revocation support. Fixes: 62e9115 mrs: remove store-side support")
This allow more granularity including allowing quarantine to exceed 1/2 the size of the heap. Replace QUARANTINE_RATIO with QUARANTINE_NUMERATOR and QUARANTINE_DENOMINATOR. The quarantine is flushed when: QUARANTINE_NUMERATOR <quarantine_size> >= <heap size> * ---------------------- QUARANTINE_DENOMINATOR The default values are QUARANTINE_NUMERATOR=1 and QUARANTINE_DENOMINATOR=4 respectively giving the same behavior as the previous default QUARANTINE_RATIO=4.
a34be82
to
b3f3df4
Compare
nwf
approved these changes
Mar 24, 2025
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.
LGTM
The environmental variables _RUNTIME_QUARANTINE_NUMERATOR and _RUNTIME_QUARANTINE_DENOMINATOR can now override compiled defaults for QUARANTINE_NUMERATOR and QUARANTINE_DENOMINATOR.
b3f3df4
to
28227a2
Compare
markjdb
approved these changes
Apr 2, 2025
@@ -1316,6 +1321,33 @@ mrs_init_impl_locked(void) | |||
exit(7); | |||
} | |||
|
|||
if (!issetugid()) { | |||
char *envstr, *end; | |||
if ((envstr = getenv(MALLOC_QUARANTINE_DENOMINATOR_ENV)) != |
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.
BTW we have secure_getenv()
in libc now, effectively a helper for if (!issetugid()) { var = getenv(...); ... }
.
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.
Replace QUARANTINE_RATIO with a fraction set by QUARANTINE_NUMERATOR and QUARANTINE_DENOMINATOR.