-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[scudo] Add time of last page release to getStats() #164004
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
Changes from all commits
eed1e1d
2df0e13
a8780e1
45e3b9f
54ba8ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,8 @@ | |
| #include "thread_annotations.h" | ||
| #include "tracing.h" | ||
|
|
||
| #include <inttypes.h> | ||
|
|
||
| namespace scudo { | ||
|
|
||
| // SizeClassAllocator64 is an allocator tuned for 64-bit address space. | ||
|
|
@@ -1146,17 +1148,24 @@ void SizeClassAllocator64<Config>::getStats(ScopedString *Str, uptr ClassId, | |
| BytesInFreeList - Region->ReleaseInfo.BytesInFreeListAtLastCheckpoint; | ||
| } | ||
| const uptr TotalChunks = Region->MemMapInfo.AllocatedUser / BlockSize; | ||
| const u64 CurTimeNs = getMonotonicTime(); | ||
| const u64 DiffSinceLastReleaseNs = | ||
| CurTimeNs - Region->ReleaseInfo.LastReleaseAtNs; | ||
| const u64 LastReleaseSecAgo = DiffSinceLastReleaseNs / 1000000000; | ||
| const u64 LastReleaseMsAgo = (DiffSinceLastReleaseNs % 1000000000) / 1000000; | ||
|
|
||
| Str->append( | ||
| "%s %02zu (%6zu): mapped: %6zuK popped: %7zu pushed: %7zu " | ||
| "inuse: %6zu total: %6zu releases attempted: %6zu last " | ||
| "released: %6zuK latest pushed bytes: %6zuK region: 0x%zx " | ||
| "(0x%zx)\n", | ||
| "(0x%zx) Latest release: %" PRIu64 ":%" PRIu64 " seconds ago\n", | ||
| Region->Exhausted ? "E" : " ", ClassId, getSizeByClassId(ClassId), | ||
| Region->MemMapInfo.MappedUser >> 10, Region->FreeListInfo.PoppedBlocks, | ||
| Region->FreeListInfo.PushedBlocks, InUseBlocks, TotalChunks, | ||
| Region->ReleaseInfo.NumReleasesAttempted, | ||
| Region->ReleaseInfo.LastReleasedBytes >> 10, RegionPushedBytesDelta >> 10, | ||
| Region->RegionBeg, getRegionBaseByClassId(ClassId)); | ||
| Region->RegionBeg, getRegionBaseByClassId(ClassId), LastReleaseSecAgo, | ||
| LastReleaseMsAgo); | ||
| } | ||
|
|
||
| template <typename Config> | ||
|
|
@@ -1486,7 +1495,7 @@ uptr SizeClassAllocator64<Config>::releaseToOSMaybe(RegionInfo *Region, | |
| Region->ReleaseInfo.BytesInFreeListAtLastCheckpoint = BytesInFreeList; | ||
| Region->ReleaseInfo.LastReleasedBytes = Recorder.getReleasedBytes(); | ||
| } | ||
| Region->ReleaseInfo.LastReleaseAtNs = getMonotonicTimeFast(); | ||
| Region->ReleaseInfo.LastReleaseAtNs = getMonotonicTime(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's fine to keep this with the fast version as long as we have the precise one in getStats
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I didn't catch this. Can you change the getMonotonicTime function back to the fast versions? This is on the hot path in some cases and might cause a regression. |
||
|
|
||
| if (Region->ReleaseInfo.PendingPushedBytesDelta > 0) { | ||
| // Instead of increasing the threshold by the amount of | ||
|
|
||
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 have a new thought about this, given that we have
ReleaseToOsInterval, can we print something like> ReleaseToOsInterval< ReleaseToOsInterval?If we hit the threshold to do the page release but it's too close (diff time less than ReleaseToOsInterval) then we will skip the page release. Thus I think longer/shorter than the interval gives us enough information about why the pages aren't released.
Sorry I didn't think about this while came up with the work
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.
Let's chat this offline for more details