In sanitizer_allocator_primary32.h:
- rounding up in MapWithCallback is not needed as MmapOrDie does it. Note that the 64-bit counterpart doesn't round up, this keeps the behavior consistent;
- since IsAligned exists, use it in AllocateRegion;
- in PopulateFreeList:
- checking b->Count to be greater than 0 when b->Count() == max_count is redundant when done more than once. Just check that max_count is greater than 0 out of the loop; the compiler (at least on ARM) didn't optimize it;
- mark the batch creation failure as UNLIKELY;
In sanitizer_allocator_primary64.h:
- in MapWithCallback, mark the failure condition as UNLIKELY;
In sanitizer_posix.h:
- mark a bunch of Mmap related failure conditions as UNLIKELY;
- in MmapAlignedOrDieOnFatalError, we have IsAligned, so use it; rearrange the conditions as one test was redudant;
- in MmapFixedImpl, 30 chars was not large enough to hold the message and a full 64-bit address (or at least a 48-bit usermode address), increase to 40.