Skip to content

Commit

Permalink
Add explaination for choice of branch on release_count_.
Browse files Browse the repository at this point in the history
Most huge pages will not be subreleased, especially if the entire application
is not using subrelease altogether.

PiperOrigin-RevId: 359841496
Change-Id: Ice909914081acdbd2760b3615ae26476ed494aa6
  • Loading branch information
ckennelly authored and copybara-github committed Feb 26, 2021
1 parent e41859b commit 0a64de6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tcmalloc/huge_page_filler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,12 @@ inline typename PageTracker<Unback>::PageAllocation PageTracker<Unback>::Get(
released_count_);

size_t unbacked = 0;
if (released_count_ > 0) {
// If release_count_ == 0, CountBits will return 0 and ClearRange will be a
// no-op (but will touch cachelines) due to the invariants guaranteed by
// CountBits() == released_count_.
//
// This is a performance optimization, not a logical requirement.
if (ABSL_PREDICT_FALSE(released_count_ > 0)) {
unbacked = released_by_page_.CountBits(index, n.raw_num());
released_by_page_.ClearRange(index, n.raw_num());
ASSERT(released_count_ >= unbacked);
Expand Down

0 comments on commit 0a64de6

Please sign in to comment.