This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Remove GetActuallyAllocatedSize calls from the fast path
ClosedPublic

Authored by cryptoad on Apr 20 2017, 9:38 AM.

Details

Summary

GetActuallyAllocatedSize is actually expensive. In order to avoid calling this
function in the malloc/free fast path, we change the Scudo chunk header to
store the size of the chunk, if from the Primary, or the amount of unused
bytes if from the Secondary. This way, we only have to call the culprit
function for Secondary backed allocations (and still in realloc).

The performance gain on a singly threaded pure malloc/free benchmark exercising
the Primary allocator is above 5%.

Event Timeline

cryptoad created this revision.Apr 20 2017, 9:38 AM
dvyukov accepted this revision.Apr 20 2017, 10:35 AM
This revision is now accepted and ready to land.Apr 20 2017, 10:35 AM
cryptoad closed this revision.Apr 20 2017, 11:20 AM