Fixed a quasi-livelock in steal_pages() as proposed in ticket #1929.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24605 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-03-27 05:42:43 +00:00
parent b40802973a
commit 332e24fb43

View File

@ -1223,11 +1223,17 @@ steal_pages(vm_page **pages, size_t count, bool reserve)
continue;
}
if (tried) {
// we had our go, but there are pages left, let someone else
// try
// We tried all potential pages, but one or more couldn't be stolen
// at that time (likely because their cache was locked). No one
// else will have any better luck, so we'll just retry a little
// later.
// TODO: Think about better strategies. E.g. if our condition
// variables had timeouts, we could just wait with timeout on
// the free page queue condition variable, which could might
// succeed earlier.
locker.Unlock();
sFreePageCondition.NotifyOne();
locker.Lock();
snooze(10000);
continue;
}
// we need to wait for pages to become inactive