LXR: add tuning knobs, fix survival predictor for non moving build - #1584
Conversation
ad326bc to
1420190
Compare
|
|
Makes sense. I have made changes on that. |
wks
left a comment
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
I think the old code incs.len() > 1 was a bug, and this fixes it.
| 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; |
There was a problem hiding this comment.
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.
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>
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.