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:
@@ -1470,8 +1470,14 @@ steal_pages(vm_page **pages, size_t count)
|
|||||||
|
|
||||||
// we need to wait for pages to become inactive
|
// we need to wait for pages to become inactive
|
||||||
|
|
||||||
ConditionVariableEntry freeConditionEntry;
|
|
||||||
sPageDeficit++;
|
sPageDeficit++;
|
||||||
|
if (sUnreservedFreePages >= 0) {
|
||||||
|
// There are enough pages available now. No need to wait after all.
|
||||||
|
sPageDeficit--;
|
||||||
|
return stolen;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConditionVariableEntry freeConditionEntry;
|
||||||
freeConditionEntry.Add(&sFreePageQueue);
|
freeConditionEntry.Add(&sFreePageQueue);
|
||||||
locker.Unlock();
|
locker.Unlock();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user