kernel/vm: Adjust committed sizes even for caches without sources.

This is now necessary after enabling delayed commitments for anonymous
mappings with PROT_NONE.

Change-Id: I33b76f9d9f6a1d560793e523b74e9ac9fd7a4f62
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8676
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2024-12-11 06:25:23 +00:00
committed by waddlesplash
parent 3cd8a6719d
commit 3fef105fae
+2 -2
View File
@@ -3141,7 +3141,7 @@ vm_set_area_protection(team_id team, area_id areaID, uint32 newProtection,
status = vm_copy_on_write_area(cache, NULL);
} else {
// No consumers, so we don't need to insert a new one.
if (cache->source != NULL && cache->temporary) {
if (cache->temporary) {
// the cache's commitment must contain all possible pages
status = cache->Commit(cache->virtual_end - cache->virtual_base,
team == VMAddressSpace::KernelID()
@@ -6316,7 +6316,7 @@ _user_set_memory_protection(void* _address, size_t size, uint32 protection)
cacheChainLocker.LockAllSourceCaches();
// Adjust the committed size, if necessary.
if (topCache->source != NULL && topCache->temporary) {
if (topCache->temporary) {
const bool becomesWritable = (protection & B_WRITE_AREA) != 0;
ssize_t commitmentChange = 0;
const off_t areaCacheBase = area->Base() - area->cache_offset;