This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Add a method to force release everything.
ClosedPublic

Authored by cferris on Mar 14 2023, 5:39 PM.

Details

Summary

The force flag to releaseToOSMaybe does not release everything
since it is an expensive operation. Modify the release flag to
have three states: normal, force, forceall. Force behaves the same
as setting Force to true from before this change. Forceall will
release everything regardless of how much time it takes, or
how much there is to release.

In addition, add a new mallopt that will call the release function
with the forceall flag set.

Diff Detail

Event Timeline

cferris created this revision.Mar 14 2023, 5:39 PM
cferris requested review of this revision.Mar 14 2023, 5:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2023, 5:39 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript

LGTM!

compiler-rt/lib/scudo/standalone/primary32.h
753–754

nit: I prefer having the brackets here because the predicate has multiple lines

BTW, it seems that I missed this before. I'm thinking if we should just delete the check here. The logic here is done while examining each memory group.

If we still want a high level rule, I would suggest to update the heuristic here. So far, I prefer to remove it but not a strong preference

Chia-hungDuan accepted this revision.Mar 14 2023, 6:39 PM
This revision is now accepted and ready to land.Mar 14 2023, 6:39 PM
cferris added inline comments.Mar 15 2023, 4:36 PM
compiler-rt/lib/scudo/standalone/primary32.h
753–754

I will remove this in a follow-on CL since I would prefer not to do this all in one.

Chia-hungDuan added inline comments.Mar 15 2023, 4:53 PM
compiler-rt/lib/scudo/standalone/primary32.h
753–754

Agree!

cferris updated this revision to Diff 505663.Mar 15 2023, 5:03 PM

clang-format a few lines.

This revision was automatically updated to reflect the committed changes.