Changes by Zhao Shuai and myself:
* The VMAnonymousCache destructor was unreserving too much physical memory. * Addressed TODO in _SwapBlockBuild(): When the swap block couldn't be allocated we wait and loop until it can. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27202 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -492,7 +492,8 @@ VMAnonymousCache::~VMAnonymousCache()
|
||||
}
|
||||
|
||||
swap_space_unreserve(fCommittedSwapSize);
|
||||
vm_unreserve_memory(committed_size);
|
||||
if (committed_size > fCommittedSwapSize)
|
||||
vm_unreserve_memory(committed_size - fCommittedSwapSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -911,13 +912,16 @@ VMAnonymousCache::_SwapBlockBuild(off_t startPageIndex,
|
||||
swap_hash_key key = { this, pageIndex };
|
||||
|
||||
swap_block *swap = sSwapHashTable.Lookup(key);
|
||||
if (swap == NULL) {
|
||||
while (swap == NULL) {
|
||||
swap = (swap_block *)object_cache_alloc(sSwapBlockCache,
|
||||
CACHE_DONT_SLEEP);
|
||||
CACHE_DONT_SLEEP);
|
||||
if (swap == NULL) {
|
||||
// TODO: wait until memory can be allocated
|
||||
// Wait a short time until memory is available again.
|
||||
mutex_unlock(&sSwapHashLock);
|
||||
return;
|
||||
snooze(10000);
|
||||
mutex_lock(&sSwapHashLock);
|
||||
swap = sSwapHashTable.Lookup(key);
|
||||
continue;
|
||||
}
|
||||
|
||||
swap->key.cache = this;
|
||||
|
||||
Reference in New Issue
Block a user