Skip to content

Commit 9edc369

Browse files
nilayvaishcopybara-github
authored andcommitted
Limit dense hugepages to using only chunk 0
Dense hugepages are only indexed using nallocs. So we do not need to compute the index for the second dimension. PiperOrigin-RevId: 817362846 Change-Id: Ifd482be6715e05ff2d064c4fa94b194f3eea632a
1 parent 754a582 commit 9edc369

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tcmalloc/huge_page_filler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,6 +3245,12 @@ template <class TrackerType>
32453245
inline size_t HugePageFiller<TrackerType>::IndexFor(
32463246
const TrackerType& pt) const {
32473247
TC_ASSERT(!pt.empty());
3248+
// For dense hugepages, the first dimension that we manage trackers along is
3249+
// nallocs. This is different from tracking for sparse spans -- the first
3250+
// dimension is the longest-free-range and the second one uses nallocs. So,
3251+
// for dense spans, there is no need to distribute them using nallocs again.
3252+
if (pt.HasDenseSpans()) return 0;
3253+
32483254
// Prefer to allocate from hugepages with many allocations already present;
32493255
// spaced logarithmically.
32503256
const size_t na = pt.nallocs();

0 commit comments

Comments
 (0)