Skip to content

LOS: Reduce is_mapped calls during VO bit scan #1341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2025

Conversation

wks
Copy link
Collaborator

@wks wks commented Jul 15, 2025

Like in find_last_non_zero_bit_in_metadata_bytes, we should only call is_mapped when we reached a new chunk because the granularity of MapState is per chunk.

Like in `find_last_non_zero_bit_in_metadata_bytes`, we should only call
`is_mapped` when we reached a new chunk because the granularity of
`MapState` is per chunk.
@wks wks requested a review from qinsoon July 15, 2025 05:26
@wks
Copy link
Collaborator Author

wks commented Jul 15, 2025

This optimization is orthogonal to #1337. While #1337 reduces the overhead of each individual is_mapped invocation, this PR reduces the number of calls of is_mapped for the LOS.

(Note that the linear searching algorithm for non-LOS spaces already take MapState's chunk granularity into consideration.)

I ran benches/mock_bench/internal_pointer.rs on several revisions, and here are the performance comparison. Numbers are the average iteration time, and the unit is nanosecond. 1337 and 1341 are PR numbers. 1337 and 1341 is a branch with both PRs merged.

space master 1337 1341 1337 + 1341
normal 101.66 83.862 94.948 78.371
LOS 294.80 30.533 94.320 27.795

Note that PR 1341 should not affect normal spaces, and the performance improvements are likely to be noises.

With either or both of PR 1337 and PR 1341 applied, the LOS searches faster (for the same object size 16KB) than other spaces because it searches at page granularity. This is the expected behavior.

@wks wks enabled auto-merge July 15, 2025 06:08
@wks wks added this pull request to the merge queue Jul 15, 2025
Merged via the queue into mmtk:master with commit 1dc6815 Jul 15, 2025
32 checks passed
@wks wks deleted the fix/linear-scan-check-mapped branch July 15, 2025 07:42
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