⛏️ index : haiku.git

author Augustin Cavalier <waddlesplash@gmail.com> 2025-11-14 14:19:20.0 -05:00:00
committer Augustin Cavalier <waddlesplash@gmail.com> 2025-11-14 18:48:25.0 -05:00:00
commit
1dd462720ef58be0aa78ea1474bf697bbf18ffb4 [patch]
tree
f08f467c7497fa106c46835a0c427b96c9dfbaf0
parent
527f059fb18d693feb1c8fe0f05cabba6624db51
download
1dd462720ef58be0aa78ea1474bf697bbf18ffb4.tar.gz

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.

Diff

 src/system/kernel/vm/VMAnonymousCache.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/system/kernel/vm/VMAnonymousCache.cpp b/src/system/kernel/vm/VMAnonymousCache.cpp
index 9322a37..5cbcc3f 100644
--- a/src/system/kernel/vm/VMAnonymousCache.cpp
+++ b/src/system/kernel/vm/VMAnonymousCache.cpp
@@ -734,9 +734,12 @@

		// 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);