[compiler-rt] [scudo] Move getResidentPages function (PR #183138)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 4 00:45:58 PST 2026
================
@@ -71,6 +71,21 @@ template <class Derived> class MemMapBase {
invokeImpl(&Derived::releaseAndZeroPagesToOSImpl, From, Size);
}
+ // Get the total number of resident pages for From to From + Size.
+ // This function can run slowly, and is only expected to be called
+ // from getStats functions where performance does not matter. From represents
+ // the absolute address of the start of a memory region, not a relative offset
+ // from getBase().
+ s64 getResidentPages(uptr From, uptr Size) {
+ if (!isAllocated()) {
+ return 0;
+ }
----------------
ChiaHungDuan wrote:
I think this is better to be handled in each MemMap instance. Otherwise, on the targets which don't support this, if they have region unallocated, it returns 0 and somehow becomes "support getResidentPages"
https://github.com/llvm/llvm-project/pull/183138
More information about the llvm-commits
mailing list