Skip to content

Commit

Permalink
[NFC][sanitizer] Exctract DrainHalfMax
Browse files Browse the repository at this point in the history
Part of D105778
  • Loading branch information
vitalybuka committed Jul 13, 2021
1 parent 5df9995 commit afa3fed
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct SizeClassAllocator64LocalCache {
PerClass *c = &per_class_[class_id];
InitCache(c);
if (UNLIKELY(c->count == c->max_count))
Drain(c, allocator, class_id, c->max_count / 2);
DrainHalfMax(c, allocator, class_id);
CompactPtrT chunk = allocator->PointerToCompactPtr(
allocator->GetRegionBeginBySizeClass(class_id),
reinterpret_cast<uptr>(p));
Expand Down Expand Up @@ -105,6 +105,10 @@ struct SizeClassAllocator64LocalCache {
c->count = num_requested_chunks;
return true;
}
NOINLINE void DrainHalfMax(PerClass *c, SizeClassAllocator *allocator,
uptr class_id) {
Drain(c, allocator, class_id, c->max_count / 2);
}

NOINLINE void Drain(PerClass *c, SizeClassAllocator *allocator, uptr class_id,
uptr count) {
Expand Down

0 comments on commit afa3fed

Please sign in to comment.