diff --git a/headers/private/kernel/vm/vm.h b/headers/private/kernel/vm/vm.h index 0c79ceecc5..352a89cf45 100644 --- a/headers/private/kernel/vm/vm.h +++ b/headers/private/kernel/vm/vm.h @@ -32,6 +32,7 @@ struct VMPageWiringInfo; #define CREATE_AREA_UNMAP_ADDRESS_RANGE 0x02 #define CREATE_AREA_DONT_CLEAR 0x04 #define CREATE_AREA_PRIORITY_VIP 0x08 +#define CREATE_AREA_DONT_COMMIT_MEMORY 0x10 // memory/page allocation priorities #define VM_PRIORITY_USER 0 diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 0eee0f8c71..c331be2731 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -794,9 +794,11 @@ map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, cache = newCache; } - status = cache->SetMinimalCommitment(size, priority); - if (status != B_OK) - goto err2; + if ((flags & CREATE_AREA_DONT_COMMIT_MEMORY) == 0) { + status = cache->SetMinimalCommitment(size, priority); + if (status != B_OK) + goto err2; + } // check to see if this address space has entered DELETE state if (addressSpace->IsBeingDeleted()) { @@ -2229,7 +2231,7 @@ vm_copy_area(team_id team, const char* name, void** _address, status = map_backing_store(targetAddressSpace, cache, _address, source->cache_offset, source->Size(), addressSpec, source->wiring, protection, sharedArea ? REGION_NO_PRIVATE_MAP : REGION_PRIVATE_MAP, - &target, name, 0, true); + &target, name, writableCopy ? 0 : CREATE_AREA_DONT_COMMIT_MEMORY, true); if (status < B_OK) return status;