Release pageheap_lock while HugePageFiller unbacks memory. - #950
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_982712772
branch
2 times, most recently
from
September 17, 2026 00:04
7132043 to
ed0d873
Compare
HugePageFiller now releases free pages through unback_without_lock_, as HugeCache already does, so allocations and deallocations proceed while the OS is unbacking a range. Since pageheap_lock is dropped for each range, concurrent operations may observe the filler mid-release: * The tracker being released is removed from the filler lists and marked BeingSubreleased(). Put() on it defers list maintenance (and the transition to empty) to the releasing thread, which handles both after ReleaseFree() returns. TryGet() cannot be served from it. * Pending release candidates are marked HugePageTreatmentType::kSubrelease, which excludes them from another release, from treatment selection, and from being freed back to the page heap should a Put() empty them. A tracker emptied while marked is parked on fully_freed_trackers_ instead; HugePageAwareAllocator drains parked trackers after each release and treatment pass, and FetchFullyFreedTracker() skips trackers that are still referenced. * HugePageUnbackedTrackerTreatment::Restore() re-checks fully_freed() after HandleReleaseFree(), which now drops the lock, and its selection skips trackers held by an in-flight release. FreePagesInPartialAllocs() is now a maintained counter rather than a derivation from list sizes, which would be transiently wrong while a tracker is off the lists. Add unit tests and fuzzer support for reentrant Put(), TryGet(), ReleasePages() and TreatHugepageTrackers() during a release, and a multi-threaded release stress test. PiperOrigin-RevId: 982712772
copybara-service
Bot
force-pushed
the
test_982712772
branch
from
September 17, 2026 01:20
ed0d873 to
50f3b30
Compare
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.
Release pageheap_lock while HugePageFiller unbacks memory.
HugePageFiller now releases free pages through unback_without_lock_, as
HugeCache already does, so allocations and deallocations proceed while the OS
is unbacking a range. Since pageheap_lock is dropped for each range, concurrent
operations may observe the filler mid-release:
BeingSubreleased(). Put() on it defers list maintenance (and the transition
to empty) to the releasing thread, which handles both after ReleaseFree()
returns. TryGet() cannot be served from it.
which excludes them from another release, from treatment selection, and from
being freed back to the page heap should a Put() empty them. A tracker
emptied while marked is parked on fully_freed_trackers_ instead;
HugePageAwareAllocator drains parked trackers after each release and
treatment pass, and FetchFullyFreedTracker() skips trackers that are still
referenced.
HandleReleaseFree(), which now drops the lock, and its selection skips
trackers held by an in-flight release.
FreePagesInPartialAllocs() is now a maintained counter rather than a derivation
from list sizes, which would be transiently wrong while a tracker is off the
lists.
Add unit tests and fuzzer support for reentrant Put(), TryGet(), ReleasePages()
and TreatHugepageTrackers() during a release, and a multi-threaded release
stress test.