Map read-only segments over-committing for the relocation. This prevents the

kernel from committing memory for all read-only segments until we're done
relocating. This allows Haiku to boot on machines with less RAM and swap
disabled. At least in qemu I could boot with 100 MB and start WebPositive.
Probably fixed #5822.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36552 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-04-30 12:09:43 +00:00
parent fe5ea7b4d2
commit 0ef0e3cfa0
+13 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2008-2009, Ingo Weinhold, [email protected].
* Copyright 2008-2010, Ingo Weinhold, [email protected].
* Copyright 2003-2009, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
@@ -354,11 +354,20 @@ map_image(int fd, char const* path, image_t* image, bool fixed)
return image->regions[i].id;
}
} else {
// Map all segments r/w first -- write access might be needed for
// relocations. When we've done with those we change the protection
// of read-only segments back to read-only. We map those segments
// over-committing, since quite likely only a relatively small
// number of pages needs to be touched and we want to avoid a lot
// of memory to be committed for them temporarily, just because we
// have to write map them.
uint32 protection = B_READ_AREA | B_WRITE_AREA
| ((image->regions[i].flags & RFLAG_RW) != 0
? 0 : B_OVERCOMMITTING_AREA);
image->regions[i].id = _kern_map_file(regionName,
(void**)&loadAddress, B_EXACT_ADDRESS,
image->regions[i].vmsize, B_READ_AREA | B_WRITE_AREA,
REGION_PRIVATE_MAP, false, fd,
PAGE_BASE(image->regions[i].fdstart));
image->regions[i].vmsize, protection, REGION_PRIVATE_MAP, false,
fd, PAGE_BASE(image->regions[i].fdstart));
if (image->regions[i].id < 0) {
_kern_unreserve_address_range(reservedAddress, reservedSize);