Skip to content

Conversation

@sadafebrahimi
Copy link

Knowing when the last page release happened can help us figure out if the page release is skipped or not.

Knowing when the last page release happened can help us figure out if
the page release is skipped or not.
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Member

llvmbot commented Nov 4, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Sadaf Ebrahimi (sadafebrahimi)

Changes

Knowing when the last page release happened can help us figure out if the page release is skipped or not.


Full diff: https://github.com/llvm/llvm-project/pull/166456.diff

1 Files Affected:

  • (modified) compiler-rt/lib/scudo/standalone/primary64.h (+11-1)
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index 747b1a2233d32..4756f6fbfde4c 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1146,17 +1146,27 @@ void SizeClassAllocator64<Config>::getStats(ScopedString *Str, uptr ClassId,
         BytesInFreeList - Region->ReleaseInfo.BytesInFreeListAtLastCheckpoint;
   }
   const uptr TotalChunks = Region->MemMapInfo.AllocatedUser / BlockSize;
+  const s32 IntervalMs = atomic_load_relaxed(&ReleaseToOsIntervalMs);
+  const u64 IntervalNs = static_cast<u64>(IntervalMs) * 1000000;
+  const u64 CurTimeNs = getMonotonicTime();
+  const u64 DiffSinceLastReleaseNs =
+      CurTimeNs - Region->ReleaseInfo.LastReleaseAtNs;
+
   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) ",
       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));
+  if (DiffSinceLastReleaseNs > IntervalNs)
+    Str->append("Last page release > ReleaseToOsInterval\n");
+  else
+    Str->append("Last page release <= ReleaseToOsInterval\n");
 }
 
 template <typename Config>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants