kernel: Don't retry or wait for the low_resource handler.

As axeld pointed out on the mailing list, map_backing_store is called
with the address space write-locked, and so the resources won't be
released until after we return.

Due to the state we are in at this point, unlocking the address space
before making this call would be likely be very dangerous, and so
simply issuing the notification and then returning an error is all
we can safely do here.
This commit is contained in:
Augustin Cavalier
2018-12-12 10:55:43 -05:00
parent 07af264afa
commit 67f185ecf5
+5 -6
View File
@@ -873,12 +873,11 @@ map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, off_t offset,
allocationFlags, _virtualAddress); allocationFlags, _virtualAddress);
if (status == B_NO_MEMORY if (status == B_NO_MEMORY
&& addressRestrictions->address_specification == B_ANY_KERNEL_ADDRESS) { && addressRestrictions->address_specification == B_ANY_KERNEL_ADDRESS) {
// issue a low resource notification and try again // Since the kernel address space is locked by the caller, we can't
low_resource(B_KERNEL_RESOURCE_ADDRESS_SPACE, size, B_RELATIVE_TIMEOUT, // wait here as of course no resources can be released while the locks
((flags & CREATE_AREA_DONT_WAIT) != 0) ? 0 : 100000 /* 100ms*/); // are held. But we can at least issue this so the next caller doesn't
// run into the same problem.
status = addressSpace->InsertArea(area, size, addressRestrictions, low_resource(B_KERNEL_RESOURCE_ADDRESS_SPACE, size, 0, 0);
allocationFlags, _virtualAddress);
} }
if (status != B_OK) if (status != B_OK)
goto err2; goto err2;