* Introduced new area creation flag CREATE_AREA_DONT_COMMIT_MEMORY.
map_backing_store() doesn't commit memory when this flag is given. * Used the new flag vm_copy_area(): We no longer commit memory for read-only areas. This prevents read-only mapped files from suddenly requiring memory after fork(). Might improve the situation on machines with very little RAM a bit. We should probably mark writable copies over-committing, since the usual case is fork() + exec() where the child normally doesn't need more than a few pages until calling exec(). That would significantly reduce the memory requirement for jamming the Haiku tree. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36651 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d55567bbf9
commit
13fa4c845a
@ -32,6 +32,7 @@ struct VMPageWiringInfo;
|
|||||||
#define CREATE_AREA_UNMAP_ADDRESS_RANGE 0x02
|
#define CREATE_AREA_UNMAP_ADDRESS_RANGE 0x02
|
||||||
#define CREATE_AREA_DONT_CLEAR 0x04
|
#define CREATE_AREA_DONT_CLEAR 0x04
|
||||||
#define CREATE_AREA_PRIORITY_VIP 0x08
|
#define CREATE_AREA_PRIORITY_VIP 0x08
|
||||||
|
#define CREATE_AREA_DONT_COMMIT_MEMORY 0x10
|
||||||
|
|
||||||
// memory/page allocation priorities
|
// memory/page allocation priorities
|
||||||
#define VM_PRIORITY_USER 0
|
#define VM_PRIORITY_USER 0
|
||||||
|
@ -794,9 +794,11 @@ map_backing_store(VMAddressSpace* addressSpace, VMCache* cache,
|
|||||||
cache = newCache;
|
cache = newCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((flags & CREATE_AREA_DONT_COMMIT_MEMORY) == 0) {
|
||||||
status = cache->SetMinimalCommitment(size, priority);
|
status = cache->SetMinimalCommitment(size, priority);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
goto err2;
|
goto err2;
|
||||||
|
}
|
||||||
|
|
||||||
// check to see if this address space has entered DELETE state
|
// check to see if this address space has entered DELETE state
|
||||||
if (addressSpace->IsBeingDeleted()) {
|
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,
|
status = map_backing_store(targetAddressSpace, cache, _address,
|
||||||
source->cache_offset, source->Size(), addressSpec, source->wiring,
|
source->cache_offset, source->Size(), addressSpec, source->wiring,
|
||||||
protection, sharedArea ? REGION_NO_PRIVATE_MAP : REGION_PRIVATE_MAP,
|
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)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user