kernel/vm: Track fault and copy counts in VMCache.

This solves a TODO for reporting CoW counts in area_info, and paves
the way for adaptive handling of pre-faulting based on how many
faults a cache has handled.

Change-Id: I4ecd7cf46b794c51acac87184fef49ea5ce76743
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8873
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2025-01-28 21:23:38 +00:00
committed by waddlesplash
parent b2b3e71456
commit 17c3890ce1
3 changed files with 24 additions and 5 deletions
+13
View File
@@ -174,6 +174,16 @@ public:
virtual status_t Fault(struct VMAddressSpace *aspace,
off_t offset);
inline uint64 FaultCount() const
{ return fFaultCount; }
inline void IncrementFaultCount()
{ fFaultCount++; }
inline uint64 CopiedPagesCount() const
{ return fCopiedPagesCount; }
inline void IncrementCopiedPagesCount()
{ fCopiedPagesCount++; }
virtual void Merge(VMCache* source);
virtual status_t AcquireUnreferencedStoreRef();
@@ -228,7 +238,10 @@ private:
PageEventWaiter* fPageEventWaiters;
void* fUserData;
VMCacheRef* fCacheRef;
page_num_t fWiredPagesCount;
uint64 fFaultCount;
uint64 fCopiedPagesCount;
};