steal_pages(): Recheck sUnreservedFreePages after incrementing sPageDeficit.

Since the former is no longer guarded by any lock, there's a race condition
with vm_page_unreserve_pages() which would cause us to wait longer than
necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34898 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-01-04 20:43:25 +00:00
parent 90daf7c61e
commit 88675a7eb2

View File

@ -1470,8 +1470,14 @@ steal_pages(vm_page **pages, size_t count)
// we need to wait for pages to become inactive
ConditionVariableEntry freeConditionEntry;
sPageDeficit++;
if (sUnreservedFreePages >= 0) {
// There are enough pages available now. No need to wait after all.
sPageDeficit--;
return stolen;
}
ConditionVariableEntry freeConditionEntry;
freeConditionEntry.Add(&sFreePageQueue);
locker.Unlock();