Skip to content

[mono][sgen] Enable configuration of nursery allowance ratio#120441

Merged
BrzVlad merged 2 commits intodotnet:mainfrom
BrzVlad:fix-sgen-params
Nov 5, 2025
Merged

[mono][sgen] Enable configuration of nursery allowance ratio#120441
BrzVlad merged 2 commits intodotnet:mainfrom
BrzVlad:fix-sgen-params

Conversation

@BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Oct 6, 2025

The option was ignored if max-heap-size wasn't set. Also remove unused gc params option.

default-allowance-ratio represents the minimum amount of heap growth that we allow before triggering a new major collection, as a relative multiplier to the nursery size. Setting this option was always skipped if max_heap is not set, which is the common case (max_heap requires specific gc knobs to be configured). This option has nothing to do with the max_heap so make sure it is correctly initialized.
Copilot AI review requested due to automatic review settings October 6, 2025 13:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables proper configuration of the nursery allowance ratio in Mono's SGen garbage collector by fixing a bug where the option was ignored when max-heap-size wasn't set. Additionally, it removes unused save-target-ratio functionality to clean up the codebase.

  • Moves the allowance ratio configuration outside the max-heap conditional block so it applies regardless of heap size settings
  • Removes the unused save_target parameter and related code from the memory governor
  • Updates documentation and help text to reflect the removed experimental option

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/mono/mono/sgen/sgen-memory-governor.h Removes save_target parameter from sgen_memgov_init function signature
src/mono/mono/sgen/sgen-memory-governor.c Moves allowance ratio configuration outside max-heap conditional and removes save_target handling
src/mono/mono/sgen/sgen-gc.c Removes save-target-ratio option parsing and updates function call and help text
src/mono/mono/sgen/sgen-conf.h Removes save target ratio constants and documentation

Copy link
Member

@lateralusX lateralusX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@BrzVlad BrzVlad merged commit d653db4 into dotnet:main Nov 5, 2025
71 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants