kernel/vm: Skip acquiring the available memory lock if there's nothing to unreserve.

This can happen when deleting VMCaches that were overcommitted or
never had any reservation, or caches that had their commitments
merged.
This commit is contained in:
Augustin Cavalier
2024-12-11 14:14:30 -05:00
parent be88b511d7
commit f8c3cc3459
+3 -2
View File
@@ -4697,10 +4697,11 @@ vm_kernel_address_space_left(void)
void
vm_unreserve_memory(size_t amount)
{
if (amount == 0)
return;
mutex_lock(&sAvailableMemoryLock);
sAvailableMemory += amount;
mutex_unlock(&sAvailableMemoryLock);
}