kernel/vm: Change cache commitment at end of Resize().

If we change it at the top, then we shrink the commitment before
we actually have released the relevant pages.
This commit is contained in:
Augustin Cavalier
2024-10-02 15:57:42 -04:00
parent 7f6fe7b354
commit 0a4a06eee3
+5 -5
View File
@@ -1157,13 +1157,9 @@ VMCache::Resize(off_t newSize, int priority)
{
TRACE(("VMCache::Resize(cache %p, newSize %" B_PRIdOFF ") old size %"
B_PRIdOFF "\n", this, newSize, this->virtual_end));
this->AssertLocked();
T(Resize(this, newSize));
status_t status = Commit(newSize - virtual_base, priority);
if (status != B_OK)
return status;
AssertLocked();
page_num_t oldPageCount = (page_num_t)((virtual_end + B_PAGE_SIZE - 1)
>> PAGE_SHIFT);
@@ -1177,6 +1173,10 @@ VMCache::Resize(off_t newSize, int priority)
;
}
status_t status = Commit(newSize - virtual_base, priority);
if (status != B_OK)
return status;
virtual_end = newSize;
return B_OK;
}