Repository navigation
Skip longest_free_range maintenance on dense PageTracker alloc/free. - #1986
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
Dense hugepages in `HugePageFiller` only serve 1-page spans and index trackers strictly by `nallocs()` rather than `longest_free_range()`, yet `PageTracker::Get` and `PageTracker::Put` still scan the full 256-bit `RangeTracker` bitmap on every allocation and deallocation under `pageheap_lock` to maintain `longest_free_`. Parameterize `RangeTracker::FindAndMark`, `Mark`, and `Unmark` with `LongestFreeMode` (`kEager` vs `kLazy`) so dense `PageTracker` operations locate or flip a single bit with `FindClear(0)` without updating `longest_free_`, and compute `longest_free_range()` lazily via `ComputeLongestFree()` only for cold telemetry readers (stats printing, sampled feature recording, and hugepage treatment). Update `PageTracker::fully_freed()` and `HugePageFiller::AddToFillerList()` to check `empty()` directly instead of comparing `longest_free_range()` to `kPagesPerHugePage`. Dense allocation now picks the lowest-index free page rather than intra-hugepage best-fit, trading minor hole-coalescing differences during subrelease for shorter `pageheap_lock` hold times. Retain the previous best-fit and eager `longest_free_` maintenance under `TCMALLOC_INTERNAL_LEGACY_LOCKING2`. PiperOrigin-RevId: 1034676187
This branch has not been deployed
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.
Skip longest_free_range maintenance on dense PageTracker alloc/free.
Dense hugepages in
HugePageFilleronly serve 1-page spans and index trackers strictly bynallocs()rather thanlongest_free_range(), yetPageTracker::GetandPageTracker::Putstill scan the full 256-bitRangeTrackerbitmap on every allocation and deallocation underpageheap_lockto maintainlongest_free_.Parameterize
RangeTracker::FindAndMark,Mark, andUnmarkwithLongestFreeMode(kEagervskLazy) so densePageTrackeroperations locate or flip a single bit withFindClear(0)without updatinglongest_free_, and computelongest_free_range()lazily viaComputeLongestFree()only for cold telemetry readers (stats printing, sampled feature recording, and hugepage treatment). UpdatePageTracker::fully_freed()andHugePageFiller::AddToFillerList()to checkempty()directly instead of comparinglongest_free_range()tokPagesPerHugePage. Dense allocation now picks the lowest-index free page rather than intra-hugepage best-fit, trading minor hole-coalescing differences during subrelease for shorterpageheap_lockhold times. Retain the previous best-fit and eagerlongest_free_maintenance underTCMALLOC_INTERNAL_LEGACY_LOCKING2.