Skip to content

test(libkernel): cover flexible budget after direct replacements - #6515

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-direct-remap-flexible-budget
Oct 19, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-direct-remap-flexible-budget

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

I added a limited-budget regression for direct mappings that replace the middle 32 KiB of a 64 KiB flexible mapping through the ordinary, typed, named and batch APIs.

The test checks that failed MAP_NOOVERWRITE calls preserve the address, budget and mapped data; successful replacements recover exactly 32 KiB, keep neighboring data intact and report direct memory; recovered capacity can actually be allocated; and releasing direct memory and cleaning up the remaining flexible pages do not release the same budget twice.

The production fix landed in #7112. This rebased PR keeps its additional regression coverage and removes the duplicate production changes. Production code is identical to main. #6491 covers flexible-over-flexible replacements; #6044 moves this test file.

Tested

Base e5c2b3c325e485ba7fd417c47c46f48aa2c89115; head 8627ac796583c9db7694c8c324546d39b7bd7016. These are CPU memory/API tests, with no title or performance claim.

  • Windows (native host): Windows 11 Pro 10.0.26300, AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER; WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release. The Release application and all system libraries (relinker, libs, including patched libraries) and selected fixtures built successfully. All 15 selected CTests passed with zero skips (3.85 s total; limited-budget regression 0.12 s).
  • Linux (VirtualBox): Ubuntu 24.04.5 LTS, kernel 7.0.0-38-generic, GCC 13.3.0, 4 vCPUs and 8 GiB RAM; VirtualBox 7.2.20 on the Windows host above. Graphics: not exercised. The library/test build (libc, libkernel, guest_memory_tests, guest_flexible_memory_budget_tests) passed, followed by all six selected CTests with zero skips. All 16,121 transferred source/dependency SHA-256 hashes matched before the build and after restoration.
  • Regression sensitivity, Linux (VirtualBox): four isolated mutations each omitted one API's existing successful-release call. Each failed the limited-budget regression at its own API with exactly 32,768 bytes still charged. After restoring the production source byte for byte and rebuilding, all six tests passed again.
  • Conventions, whitespace and main-sync checks passed. The registration audit passed on both configurations: 983 Windows and 995 Linux (VirtualBox) test executable targets, with none newly unregistered.

The focused CTest filter on both platforms includes guest_memory and all five guest_flexible_memory_* modes. Windows additionally ran patched_libraries, guest_kernel_sys, guest_memory_pool_stats, guest_jit_shared_memory, guest_addresses, guest_mmap_fixed_anonymous, guest_mprotect_unmapped, guest_page_table_stats and guest_mlock.

Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox validation. Native/bare-metal Linux was not tested. Native Linux GPU validation: not tested. The Linux application and unrelated test targets were not built. No GPU execution or retail/homebrew title was tested. Hosted full builds require collaborator dispatch; local results do not replace those jobs.

Checklist

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestFlexibleMemoryBudget.cpp

@Pouare514

Copy link
Copy Markdown
Contributor

Heads-up from #7112 (open, mine): partial overlap with this PR - both release flexible budget after direct replacements. #7112 additionally scopes _releaseFlexible to tracked ranges (fixes over-release on munmap of direct/reserved ranges, the TLOU 2^64-wrap direction), covers _mapFlexible release-then-record + ReserveVirtualRange, and pins it in guest_memory. Proposal: whichever lands first, the other rebases (my PR can adopt your _mapDirect helper shape and keep scoping + tests, or vice versa). No action needed now, just flagging to avoid surprise at merge.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
@Ondra97
Ondra97 force-pushed the codex/fix-direct-remap-flexible-budget branch from 2e889dc to 8627ac7 Compare October 18, 2026 08:51
@Ondra97 Ondra97 changed the title fix(libkernel): release flexible budget after direct replacements test(libkernel): cover flexible budget after direct replacements Oct 18, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@adriadam10
adriadam10 merged commit ca13a56 into boykopovar:main Oct 19, 2026
9 checks passed
@Ondra97
Ondra97 deleted the codex/fix-direct-remap-flexible-budget branch October 19, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants