This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Correct performance regression in Secondary
ClosedPublic

Authored by cryptoad on Dec 5 2017, 2:54 PM.

Details

Summary

This wasn't noticed: RoundUpTo doesn't produce a constant expression, so the
sizes were not constant either. Enforce them to be static const, replace
RoundUpTo by its expression. The compiler can now optimize the associated
computations accordingly.

Also looking at the produced assembly, PageSize was fetched multiple times
during Allocate, so keep a local value of it. As a result it's fetched once
and kept in a register.

Event Timeline

cryptoad created this revision.Dec 5 2017, 2:54 PM
alekseyshl accepted this revision.Dec 5 2017, 3:26 PM
alekseyshl added inline comments.
lib/scudo/scudo_allocator_secondary.h
131–133

Maybe use constexpr?

This revision is now accepted and ready to land.Dec 5 2017, 3:26 PM
cryptoad updated this revision to Diff 125742.Dec 6 2017, 8:52 AM
cryptoad marked an inline comment as done.

Replacing some const with constexpr.

cryptoad closed this revision.Dec 6 2017, 8:53 AM