fix(ktuner): shmall target uses runtime page size#1337
Open
jfeng18 wants to merge 1 commit into
Open
Conversation
eval_shmall hardcoded a 4096-byte page size to convert RAM to pages, but shmall is measured in pages and page size is arch-dependent (up to 64 KiB on arm64). On 64K-page kernels this over-recommended ~16x. Read the page size at runtime via sysconf(_SC_PAGESIZE); extract a pure shmall_target_pages() covered by a discriminating test across page sizes (replacing the previous vacuous if-let test).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
eval_shmallhardcoded a 4096-byte page size when converting RAM to pages.kernel.shmallis measured in pages, and page size is architecture-dependent (4 KiB on x86_64, up to 64 KiB on arm64). On 64K-page kernels the recommended value was ~16x too high.Fix
sysconf(_SC_PAGESIZE)(fallback 4096).shmall_target_pages(mem_gb, page_size)that guardspage_size == 0.if lettest with a discriminating one: asserts the 4K result equals the 64K result x16, andpage_size 0 -> 0.Testing
cargo fmt --check/clippy --all-targets -- -D warnings/cargo testall pass (192 tests)./2fails — the test is discriminating.