Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ contain multiple regions.
```
HugeRegionSet: 1 MiB+ allocations best-fit into 1024 MiB slabs
HugeRegionSet: 0 total regions
HugeRegionSet: 0 hugepages backed out of 0 total
HugeRegionSet: 0 hugepages backed, 0 backed and free, 0 low water mark free backed, out of 0 total
HugeRegionSet: 0 pages free in backed region, 0.0000 free
```

Expand All @@ -842,8 +842,9 @@ The lines of output indicate:
* The size of each region in MiB - this is currently 1GiB.
* The total number of regions in the region cache, in the example above there
are no regions in the cache.
* The number of backed hugepages in the cache out of the total number of
hugepages in the region cache.
* The number of backed hugepages in the cache, backed and free, the low water
mark of free backed pages, out of the total number of hugepages in the
region cache.
* The number of free TCMalloc pages in the regions, and as a ratio of the
number of backed pages.

Expand Down
6 changes: 4 additions & 2 deletions tcmalloc/huge_region.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,9 @@ inline void HugeRegionSet<Region>::Print(Printer& out) const {

out.printf(
"HugeRegionSet: %zu hugepages backed, %zu backed and free, "
"out of %zu total\n",
"%zu low water mark free backed, out of %zu total\n",
total_backed.raw_num(), total_free_backed.raw_num(),
Region::size().raw_num() * n_);
lowater_free_backed_.raw_num(), Region::size().raw_num() * n_);

const Length in_pages = total_backed.in_pages();
out.printf("HugeRegionSet: %zu pages free in backed region, %.4f free\n",
Expand All @@ -672,6 +672,8 @@ template <typename Region>
inline void HugeRegionSet<Region>::PrintInPbtxt(PbtxtRegion& hpaa) const {
hpaa.PrintI64("min_huge_region_alloc_size", 1024 * 1024);
hpaa.PrintI64("huge_region_size", Region::size().in_bytes());
hpaa.PrintI64("huge_region_low_water_mark_bytes",
lowater_free_backed_.in_bytes());
for (Region* region : list_) {
auto detail = hpaa.CreateSubRegion("huge_region_details");
region->PrintInPbtxt(detail);
Expand Down
9 changes: 9 additions & 0 deletions tcmalloc/huge_region_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,15 @@ TEST_P(HugeRegionSetTest, Set) {
Printer out(&buf[0], buf.size());
set_.Print(out);
printf("%s\n", &buf[0]);
EXPECT_THAT(absl::string_view(&buf[0]),
testing::HasSubstr("0 low water mark free backed"));

std::vector<char> pbtxt_buf(64 * 1024);
Printer pbtxt_out(&pbtxt_buf[0], pbtxt_buf.size());
PbtxtRegion region(pbtxt_out, kNested);
set_.PrintInPbtxt(region);
EXPECT_THAT(absl::string_view(&pbtxt_buf[0]),
testing::HasSubstr("huge_region_low_water_mark_bytes: 0"));
}

TEST(HugeRegionNamedVmaTest, NamedVmaNormal) {
Expand Down
Loading