Skip to content

Commit

Permalink
Fix huge_page_aware_allocator_fuzz test.
Browse files Browse the repository at this point in the history
The access density for > (kPagesPerHugepages / 2) allocation should be set to kSparse as it might be allocated from HugeRegion that might result in donations to filler. All donations to filler have sparse access density.

PiperOrigin-RevId: 572994494
Change-Id: Ia9b386d982f8a34ee6d6151498c4074e184467d9
  • Loading branch information
v-gogte authored and copybara-github committed Oct 12, 2023
1 parent 3a84a71 commit 188865b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tcmalloc/huge_page_aware_allocator_fuzz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
break;
}

// Allocation is too big for filler if we try to allocate >
// kPagesPerHugePage / 2 run of pages. The allocations may go to
// HugeRegion and that might lead to donations with kSparse density.
if (length > kPagesPerHugePage / 2) {
density = AccessDensityPrediction::kSparse;
}

Span* s;
SpanAllocInfo alloc_info = {.objects_per_span = num_objects,
.density = density};
Expand Down
Binary file not shown.

0 comments on commit 188865b

Please sign in to comment.