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.