vm_soft_fault(): map_page() can fail for B_NO_LOCK areas, since it needs to

allocate a page mapping. In that case we do at least have to mark the page
not busy again. Furthermore we enforce the minimum page mappings object cache
reserve, so we'll have more luck on the next fault.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35241 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-01-22 19:58:04 +00:00
parent 789d560bc6
commit 8a65066a11

View File

@ -3885,8 +3885,29 @@ vm_soft_fault(VMAddressSpace* addressSpace, addr_t originalAddress,
DEBUG_PAGE_ACCESS_END(mappedPage);
}
if (mapPage)
map_page(area, context.page, address, newProtection);
if (mapPage) {
if (map_page(area, context.page, address, newProtection) != B_OK) {
// Mapping can only fail, when the page mapping object couldn't
// be allocated. Save for the missing mapping everything is
// fine, though. We'll simply leave and probably fault again.
// To make sure we'll have more luck then, we ensure that the
// minimum object reserve is available.
if (context.page->state == PAGE_STATE_BUSY)
vm_page_set_state(context.page, PAGE_STATE_ACTIVE);
DEBUG_PAGE_ACCESS_END(context.page);
context.UnlockAll();
if (object_cache_reserve(gPageMappingsObjectCache, 1, 0)
!= B_OK) {
// Apparently the situation is serious. Let's get ourselves
// killed.
status = B_NO_MEMORY;
}
break;
}
}
DEBUG_PAGE_ACCESS_END(context.page);