kernel/vm: Rename VMCache::HasPage to StoreHasPage.

It checks whether the page or page's data is present in an underlying
"backing store", not whether the page is present in the cache itself.

No functional change intended.
This commit is contained in:
Augustin Cavalier
2025-01-22 16:19:33 -05:00
parent ece9fcbaa8
commit 414774d79f
11 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -47,7 +47,7 @@ VMVnodeCache::Commit(off_t size, int priority)
bool
VMVnodeCache::HasPage(off_t offset)
VMVnodeCache::StoreHasPage(off_t offset)
{
return ROUNDUP(offset, B_PAGE_SIZE) >= virtual_base
&& offset < virtual_end;
@@ -114,7 +114,7 @@ VMVnodeCache::WriteAsync(off_t offset, const generic_io_vec* vecs, size_t count,
status_t
VMVnodeCache::Fault(struct VMAddressSpace* aspace, off_t offset)
{
if (!HasPage(offset))
if (!StoreHasPage(offset))
return B_BAD_ADDRESS;
// vm_soft_fault() reads the page in.
+1 -1
View File
@@ -19,7 +19,7 @@ public:
uint32 allocationFlags);
virtual status_t Commit(off_t size, int priority);
virtual bool HasPage(off_t offset);
virtual bool StoreHasPage(off_t offset);
virtual status_t Read(off_t offset, const generic_io_vec* vecs,
size_t count, uint32 flags,
+3 -3
View File
@@ -750,7 +750,7 @@ VMAnonymousCache::CanOvercommit()
bool
VMAnonymousCache::HasPage(off_t offset)
VMAnonymousCache::StoreHasPage(off_t offset)
{
if (_SwapBlockGetAddress(offset >> PAGE_SHIFT) != SWAP_SLOT_NONE)
return true;
@@ -760,7 +760,7 @@ VMAnonymousCache::HasPage(off_t offset)
bool
VMAnonymousCache::DebugHasPage(off_t offset)
VMAnonymousCache::DebugStoreHasPage(off_t offset)
{
off_t pageIndex = offset >> PAGE_SHIFT;
swap_hash_key key = { this, pageIndex };
@@ -991,7 +991,7 @@ VMAnonymousCache::Fault(struct VMAddressSpace* aspace, off_t offset)
}
}
if (fCanOvercommit && LookupPage(offset) == NULL && !HasPage(offset)) {
if (fCanOvercommit && LookupPage(offset) == NULL && !StoreHasPage(offset)) {
if (fPrecommittedPages == 0) {
// never commit more than needed
if (committed_size / B_PAGE_SIZE > page_count)
+2 -2
View File
@@ -51,8 +51,8 @@ public:
virtual bool CanOvercommit();
virtual status_t Commit(off_t size, int priority);
virtual bool HasPage(off_t offset);
virtual bool DebugHasPage(off_t offset);
virtual bool StoreHasPage(off_t offset);
virtual bool DebugStoreHasPage(off_t offset);
virtual int32 GuardSize() { return fGuardedSize; }
virtual void SetGuardSize(int32 guardSize)
@@ -113,7 +113,7 @@ VMAnonymousNoSwapCache::CanOvercommit()
bool
VMAnonymousNoSwapCache::HasPage(off_t offset)
VMAnonymousNoSwapCache::StoreHasPage(off_t offset)
{
return false;
}
@@ -26,7 +26,7 @@ public:
virtual bool CanOvercommit();
virtual status_t Commit(off_t size, int priority);
virtual bool HasPage(off_t offset);
virtual bool StoreHasPage(off_t offset);
virtual int32 GuardSize() { return fGuardedSize; }
virtual void SetGuardSize(int32 guardSize)
+4 -4
View File
@@ -1323,7 +1323,7 @@ VMCache::Commit(off_t size, int priority)
changes in the meantime).
*/
bool
VMCache::HasPage(off_t offset)
VMCache::StoreHasPage(off_t offset)
{
// In accordance with Fault() the default implementation doesn't have a
// backing store and doesn't allow faults.
@@ -1425,14 +1425,14 @@ VMCache::ReleaseStoreRef()
}
/*! Kernel debugger version of HasPage().
/*! Kernel debugger version of StoreHasPage().
Does not do any locking.
*/
bool
VMCache::DebugHasPage(off_t offset)
VMCache::DebugStoreHasPage(off_t offset)
{
// default that works for all subclasses that don't lock anyway
return HasPage(offset);
return StoreHasPage(offset);
}
+1 -1
View File
@@ -4316,7 +4316,7 @@ fault_get_page(PageFaultContext& context)
// The current cache does not contain the page we're looking for.
// see if the backing store has it
if (cache->HasPage(context.cacheOffset)) {
if (cache->StoreHasPage(context.cacheOffset)) {
// insert a fresh page and mark it busy -- we're going to read it in
page = vm_page_allocate_page(&context.reservation,
PAGE_STATE_ACTIVE | VM_PAGE_ALLOC_BUSY);
+1 -1
View File
@@ -809,7 +809,7 @@ vm_debug_copy_page_memory(team_id teamID, void* unsafeMemory, void* buffer,
// Page not found in this cache -- if it is paged out, we must not try
// to get it from lower caches.
if (cache->DebugHasPage(cacheOffset))
if (cache->DebugStoreHasPage(cacheOffset))
break;
cache = cache->source;
+1 -1
View File
@@ -2587,7 +2587,7 @@ free_page_swap_space(int32 index)
VMCache* cache = page->Cache();
if (cache->temporary && page->WiredCount() == 0
&& cache->HasPage(page->cache_offset << PAGE_SHIFT)
&& cache->StoreHasPage(page->cache_offset << PAGE_SHIFT)
&& page->usage_count > 0) {
// TODO: how to judge a page is highly active?
if (swap_free_page_swap_space(page)) {