Skip to content

LXR: add tuning knobs, fix survival predictor for non moving build - #1584

Merged
qinsoon merged 2 commits into
mmtk:masterfrom
qinsoon:lxr-non-moving-gc-trigger
Sep 11, 2026
Merged

qinsoon merged 2 commits into
mmtk:masterfrom
qinsoon:lxr-non-moving-gc-trigger

Conversation

@qinsoon

@qinsoon qinsoon commented Sep 11, 2026

Copy link
Copy Markdown
Member

This PR exposes some tuning knobs for LXR as options, and maintains total promotion volume and ratio (besides the existing copy promotion volume and ratio).

The behavior on OpenJDK using those options' default values should be identical to master.

@qinsoon
qinsoon force-pushed the lxr-non-moving-gc-trigger branch from ad326bc to 1420190 Compare September 11, 2026 04:45
@qinsoon
qinsoon requested a review from wks September 11, 2026 05:00
@wks

wks commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

lxr_inc_buffer_limit uses the value 0 for "unlimited", while lxr_max_stw_sweep_nursery_blocks and lxr_min_packet_split_size use usize::MAX. Although it doesn't prevent the code work correctly, I think it is better to make them consistent. I recommend using usize::MAX which is consistent with the DEFAULT_STRESS_FACTOR which is usize::max.

@qinsoon

qinsoon commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

lxr_inc_buffer_limit uses the value 0 for "unlimited", while lxr_max_stw_sweep_nursery_blocks and lxr_min_packet_split_size use usize::MAX. Although it doesn't prevent the code work correctly, I think it is better to make them consistent. I recommend using usize::MAX which is consistent with the DEFAULT_STRESS_FACTOR which is usize::max.

Makes sense. I have made changes on that.

@wks wks left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

I think there are bugs in the old code. One is fixed by this PR, and the other can be discussed in group. This PR is OK.

incs.clear();
self.new_incs.swap(&mut incs);
if ACTIVE_PACKET_SPLIT && depth >= 16 && incs.len() > 1 {
if depth as usize >= split_depth && incs.len() > split_size {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the old code incs.len() > 1 was a bug, and this fixes it.

Comment thread src/plan/lxr/global.rs
Comment on lines +120 to +126
let ratio = if LXR_CONSTRAINTS.moves_objects {
super::SURVIVAL_RATIO_PREDICTOR.copy_promote_ratio()
} else {
super::SURVIVAL_RATIO_PREDICTOR.promote_ratio()
};
let predicted_survival_mb: usize = ((total_young_alloc_pages as f64 * ratio) as usize)
<< LOG_CONSERVATIVE_SURVIVAL_RATIO_MULTIPLER;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This behaves identical to the old code, but I think it may have been a bug. For copying LXR, it looks like in-place promoted objects didn't survive at all. However, in-place promoted objects still occupy heap space, and they occupy even more space than evacuated objects due to lack of defragmentation.

I think it is OK for this PR, but we can discuss this in the group.

@qinsoon
qinsoon enabled auto-merge September 11, 2026 07:12
@qinsoon
qinsoon added this pull request to the merge queue Sep 11, 2026
Merged via the queue into mmtk:master with commit dfa4a2f Sep 11, 2026
32 of 34 checks passed
@qinsoon
qinsoon deleted the lxr-non-moving-gc-trigger branch September 11, 2026 09:21
qinsoon added a commit to oscardssmith/mmtk-core that referenced this pull request Sep 14, 2026
Upstream absorbed the four LXR tuning knobs this branch carried as env
vars (mmtk#1584) and renamed the object-log feature (mmtk#1583), so the branch's
versions are dropped in favour of upstream's:

- `inc_buffer_limit()`, `active_packet_split()`,
  `max_stw_sweep_nursery_blocks()` and `max_survival_mb()` are removed;
  their call sites now read `options.lxr_inc_buffer_limit`,
  `lxr_min_packet_split_size`/`lxr_min_packet_split_depth`,
  `lxr_max_stw_sweep_nursery_blocks` and `lxr_max_survival_mb`.
- `SurvivalRatioPredictor::promotion_ratio()` is upstream's
  `promote_ratio()`, `ratio()` is `copy_promote_ratio()`, and
  `update_ratio()` is `update_ratios()`. The local predictor's
  single-argument `record_promotion` is superseded by upstream's
  `record_promotion(size, copied)`.
- Feature `lxr-object-log` is now `lxr_object_log`.

Note the defaults change with the knobs: upstream ships packet splitting
off (`lxr_min_packet_split_size` = usize::MAX) and full in-pause nursery
sweeping (`lxr_max_stw_sweep_nursery_blocks` = usize::MAX), where this
branch defaulted to splitting at 64 slots and deferring all nursery
sweeps. Both remain reachable via MMTK_* env vars.

Kept branch-side: `dec_origin` and `mapped_chunk` on
`LXRFieldBarrierSemantics`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants