Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions compiler-rt/lib/scudo/standalone/primary32.h
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,6 @@ uptr SizeClassAllocator32<Config>::releaseToOSMaybe(SizeClassInfo *Sci,
uptr ClassId,
ReleaseToOS ReleaseType)
REQUIRES(Sci->Mutex) {
SCUDO_SCOPED_TRACE(GetPrimaryReleaseToOSMaybeTraceName(ReleaseType));

const uptr BlockSize = getSizeByClassId(ClassId);

DCHECK_GE(Sci->FreeListInfo.PoppedBlocks, Sci->FreeListInfo.PushedBlocks);
Expand Down Expand Up @@ -1096,6 +1094,12 @@ uptr SizeClassAllocator32<Config>::releaseToOSMaybe(SizeClassInfo *Sci,
// 2. Mark the free blocks and we can tell which pages are in-use by
// querying `PageReleaseContext`.
// ==================================================================== //

// Only add trace point after the quick returns have occurred to avoid
// incurring performance penalties. Most of the time in this function
// will be the mark free blocks call and the actual release to OS call.
SCUDO_SCOPED_TRACE(GetPrimaryReleaseToOSMaybeTraceName(ReleaseType));

PageReleaseContext Context = markFreeBlocks(Sci, ClassId, BlockSize, Base,
NumberOfRegions, ReleaseType);
if (!Context.hasBlockMarked())
Expand Down
8 changes: 6 additions & 2 deletions compiler-rt/lib/scudo/standalone/primary64.h
Original file line number Diff line number Diff line change
Expand Up @@ -1379,8 +1379,6 @@ uptr SizeClassAllocator64<Config>::releaseToOSMaybe(RegionInfo *Region,
uptr ClassId,
ReleaseToOS ReleaseType)
REQUIRES(Region->MMLock) EXCLUDES(Region->FLLock) {
SCUDO_SCOPED_TRACE(GetPrimaryReleaseToOSMaybeTraceName(ReleaseType));

const uptr BlockSize = getSizeByClassId(ClassId);
uptr BytesInFreeList;
const uptr AllocatedUserEnd =
Expand Down Expand Up @@ -1444,6 +1442,12 @@ uptr SizeClassAllocator64<Config>::releaseToOSMaybe(RegionInfo *Region,
// Then we can tell which pages are in-use by querying
// `PageReleaseContext`.
// ==================================================================== //

// Only add trace point after the quick returns have occurred to avoid
// incurring performance penalties. Most of the time in this function
// will be the mark free blocks call and the actual release to OS call.
SCUDO_SCOPED_TRACE(GetPrimaryReleaseToOSMaybeTraceName(ReleaseType));

PageReleaseContext Context =
markFreeBlocks(Region, BlockSize, AllocatedUserEnd,
getCompactPtrBaseByClassId(ClassId), GroupsToRelease);
Expand Down