* Avoid calling vm_unreserve_memory() if there is no change in the commited
size. Removes a bit of overhead (call and mutex_lock / mutex_unlock). * Don't fail if there is exactly enough memory available to satisfy the reserve request. Not that it would really matter as it's rather an edge case... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26246 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4761,7 +4761,7 @@ vm_try_reserve_memory(size_t amount)
|
||||
|
||||
//dprintf("try to reserve %lu bytes, %Lu left\n", amount, sAvailableMemory);
|
||||
|
||||
if (sAvailableMemory > amount) {
|
||||
if (sAvailableMemory >= amount) {
|
||||
sAvailableMemory -= amount;
|
||||
status = B_OK;
|
||||
} else
|
||||
|
||||
@@ -66,6 +66,9 @@ anonymous_commit(struct vm_store *_store, off_t size)
|
||||
size = precommitted;
|
||||
}
|
||||
|
||||
if (size == store->vm.committed_size)
|
||||
return B_OK;
|
||||
|
||||
// Check to see how much we could commit - we need real memory
|
||||
|
||||
if (size > store->vm.committed_size) {
|
||||
|
||||
Reference in New Issue
Block a user