From 74d2e61ee2f658a0611610c7628dd5f3955c5079 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Sat, 20 May 2023 12:48:13 +1000 Subject: [PATCH] kernel/vm: Make cut_area respect overcommitting flag `cut_area` now checks the protection of the target area for the `B_OVERCOMMITTING_AREA` flag and sets it on any cache it creates. This allows operations that split large overcommitting areas to succeed. Change-Id: I8dee27d22df29741cc61af2575c9e6626da25949 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6391 Tested-by: Commit checker robot Reviewed-by: waddlesplash --- src/system/kernel/vm/vm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 0fe2eeadd5..292b3826ac 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -745,7 +745,8 @@ cut_area(VMAddressSpace* addressSpace, VMArea* area, addr_t address, if (onlyCacheUser) { // Create a new cache for the second area. VMCache* secondCache; - error = VMCacheFactory::CreateAnonymousCache(secondCache, false, 0, 0, + error = VMCacheFactory::CreateAnonymousCache(secondCache, + area->protection & B_OVERCOMMITTING_AREA, 0, 0, dynamic_cast(cache) == NULL, priority); if (error != B_OK) { addressSpace->ShrinkAreaTail(area, oldSize, allocationFlags);