kernel/vm: Decommit discarded pages of overcommitted caches.
Overcommitted caches should only have commitments equal to the number of pages they actually contain, so we should decommit whenever pages are discarded. This changes the API of VMCache::Discard to return an ssize_t of the size of pages that were discarded (or a negative error on failure.) Nothing checked the return value besides things in VMCache itself, it appears; but it apparently never fails, so that's fine. Also add asserts to Commit() that the new commitment at least encompasses all pages the cache actually contains.
This commit is contained in:
@@ -135,7 +135,7 @@ public:
|
||||
virtual status_t Adopt(VMCache* source, off_t offset, off_t size,
|
||||
off_t newOffset);
|
||||
|
||||
virtual status_t Discard(off_t offset, off_t size);
|
||||
virtual ssize_t Discard(off_t offset, off_t size);
|
||||
|
||||
status_t FlushAndRemoveAllPages();
|
||||
|
||||
@@ -220,7 +220,7 @@ private:
|
||||
void _RemoveConsumer(VMCache* consumer);
|
||||
|
||||
bool _FreePageRange(VMCachePagesTree::Iterator it,
|
||||
page_num_t* toPage);
|
||||
page_num_t* toPage, page_num_t* discarded);
|
||||
|
||||
private:
|
||||
int32 fRefCount;
|
||||
|
||||
Reference in New Issue
Block a user