kernel/vm: Don't shrink commitment on precommit in VMAnonymousCache.

If we were "donated" some commitment (e.g. in copy_on_write_area)
then we don't want to drop it when pre-committing.

Fixes some commitments being too low in forked teams.
This commit is contained in:
Augustin Cavalier
2025-11-14 18:48:25 -05:00
parent 527f059fb1
commit 1dd462720e
+4 -1
View File
@@ -734,9 +734,12 @@ VMAnonymousCache::Commit(off_t size, int priority)
// pre-commit some pages to make a later failure less probable
fHasPrecommitted = true;
uint32 precommitted = fPrecommittedPages * B_PAGE_SIZE;
uint32 precommitted = (fPrecommittedPages * B_PAGE_SIZE);
if (size > precommitted)
size = precommitted;
// pre-commit should not shrink existing commitment
size += committed_size;
}
return _Commit(size, priority);