kernel/vm: Ignore insertion hints when the address space is over half full.
We ideally want to avoid further fragmentation and just insert in the smallest possible slot in that case. Part of #19592. With DISABLE_ASLR=1, seems to save about 120 MB or so of address space, which is a lot on 32-bit.
This commit is contained in:
@@ -578,15 +578,16 @@ VMUserAddressSpace::_InsertAreaSlot(addr_t start, addr_t size, addr_t end,
|
|||||||
|
|
||||||
start = align_address(start, alignment);
|
start = align_address(start, alignment);
|
||||||
|
|
||||||
bool useHint
|
bool useHint = addressSpec != B_EXACT_ADDRESS
|
||||||
= addressSpec != B_EXACT_ADDRESS && !is_base_address_spec(addressSpec);
|
&& !is_base_address_spec(addressSpec)
|
||||||
|
&& fFreeSpace > (Size() / 2);
|
||||||
|
|
||||||
addr_t originalStart = 0;
|
addr_t originalStart = 0;
|
||||||
if (fRandomizingEnabled && addressSpec == B_RANDOMIZED_BASE_ADDRESS) {
|
if (fRandomizingEnabled && addressSpec == B_RANDOMIZED_BASE_ADDRESS) {
|
||||||
originalStart = start;
|
originalStart = start;
|
||||||
start = _RandomizeAddress(start, end - size + 1, alignment, true);
|
start = _RandomizeAddress(start, end - size + 1, alignment, true);
|
||||||
} else if (useHint
|
} else if (useHint
|
||||||
&& start <= fNextInsertHint && fNextInsertHint <= end - size + 1) {
|
&& start <= fNextInsertHint && fNextInsertHint <= (end - size + 1)) {
|
||||||
originalStart = start;
|
originalStart = start;
|
||||||
start = fNextInsertHint;
|
start = fNextInsertHint;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user