This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Simplify populateFreelist
ClosedPublic

Authored by cryptoad on Nov 3 2020, 11:22 AM.

Details

Summary

populateFreelist was more complicated that it needed to be. We used
to call to populateBatches that would do some internal shuffling and
add pointers one by one to the batches, but ultimately this was not
needed. We can get rid of populateBatches, and do processing in
bulk. This doesn't necessarily make things faster as this is not on the
hot path, but it makes the function cleaner.

Additionally clean up a couple of items, like UNLIKELYs and setting
Exhausted to false which can't happen.

Diff Detail

Event Timeline

cryptoad created this revision.Nov 3 2020, 11:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 3 2020, 11:22 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
cryptoad requested review of this revision.Nov 3 2020, 11:22 AM
cryptoad updated this revision to Diff 302651.Nov 3 2020, 11:51 AM

Re-add a comment that got removed.

cryptoad updated this revision to Diff 302727.Nov 3 2020, 6:30 PM

Changing some lines around.

cryptoad updated this revision to Diff 302958.Nov 4 2020, 1:20 PM

Restoring a couple of UNLIKELY in the loops.

cryptoad updated this revision to Diff 302962.Nov 4 2020, 1:40 PM

And another, sorry for the back & forth, getting numbers as they come.

pcc added a comment.Nov 5 2020, 3:02 PM

LGTM

With this change we will end up with blocks distributed randomly among all of the transfer batches that we create at one time instead of having all of a transfer batch's blocks be consecutive. So we improve randomness at the cost of some locality which could impact performance. I'd be fine with letting this land though and we can see if it significantly impacts performance in practice once it's picked up downstream.

pcc accepted this revision.Nov 5 2020, 3:02 PM
This revision is now accepted and ready to land.Nov 5 2020, 3:02 PM
This revision was automatically updated to reflect the committed changes.