From 02cd58f41875fb5291b1e700ed203de8fa5f0c4c Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 28 Jun 2011 00:15:12 +0000 Subject: [PATCH] Move resizing the page_protections before resizing the cache to avoid a needless resize operation that has to be undone and may fail when doing so. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42332 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index e5879ee84c..97ba711709 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -4761,10 +4761,6 @@ vm_resize_area(area_id areaID, size_t newSize, bool kernel) } } - // shrinking the cache can't fail, so we do it now - if (status == B_OK && newSize < oldSize) - status = cache->Resize(cache->virtual_base + newSize, priority); - if (status == B_OK) { // Shrink or grow individual page protections if in use. if (area->page_protections != NULL) { @@ -4792,6 +4788,10 @@ vm_resize_area(area_id areaID, size_t newSize, bool kernel) } } + // shrinking the cache can't fail, so we do it now + if (status == B_OK && newSize < oldSize) + status = cache->Resize(cache->virtual_base + newSize, priority); + if (status != B_OK) { // Something failed -- resize the areas back to their original size. // This can fail, too, in which case we're seriously screwed.