Skip to content

Optimize HugePageFiller::RecordLifetime and cache lifetime bucket bounds. - #945

Draft
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_982641116
Draft

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_982641116

Conversation

@copybara-service

Copy link
Copy Markdown

Optimize HugePageFiller::RecordLifetime and cache lifetime bucket bounds.

Eliminate per-release clock_.freq() calls and absl::Duration round-trips in
HugePageFiller::RecordLifetime under pageheap_lock by precomputing ms_per_cycle_
(1000.0 / clock_.freq()) in HugePageFiller's constructor and passing elapsed
milliseconds directly to LifetimeBucketNum(int64_t).

Replace the 72-byte instance array lifetime_bucket_bounds_[9] in UsageInfo and
HugePageFiller with static constexpr kLifetimeBucketBounds. Combined with the
8-byte ms_per_cycle_ field, this reduces HugePageFiller size by exactly 64 bytes
(one cache line), preserving 64-byte cache-line alignment for all subsequent
members in HugePageAwareAllocator while eliminating constructor loop overhead.

…nds.

Eliminate per-release clock_.freq() calls and absl::Duration round-trips in
HugePageFiller::RecordLifetime under pageheap_lock by precomputing ms_per_cycle_
(1000.0 / clock_.freq()) in HugePageFiller's constructor and passing elapsed
milliseconds directly to LifetimeBucketNum(int64_t).

Replace the 72-byte instance array lifetime_bucket_bounds_[9] in UsageInfo and
HugePageFiller with static constexpr kLifetimeBucketBounds. Combined with the
8-byte ms_per_cycle_ field, this reduces HugePageFiller size by exactly 64 bytes
(one cache line), preserving 64-byte cache-line alignment for all subsequent
members in HugePageAwareAllocator while eliminating constructor loop overhead.

PiperOrigin-RevId: 982641116
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.

1 participant