This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Support partial concurrent page release in SizeClassAllocator64
ClosedPublic

Authored by Chia-hungDuan on Jun 22 2023, 10:19 PM.

Details

Summary

After extracting memory groups, it's safe to do

  1. markFreeBlocks
  2. releaseFreeMemoryToOS concurrently with pushBlocks() and

popBatches(). This will improve the throughput of Scudo.

Diff Detail

Event Timeline

Chia-hungDuan created this revision.Jun 22 2023, 10:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 10:19 PM
Chia-hungDuan requested review of this revision.Jun 22 2023, 10:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 10:19 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
Chia-hungDuan edited the summary of this revision. (Show Details)Jun 23 2023, 11:26 AM

Add more comment on the special ScopedUnlock

cferris requested changes to this revision.Jun 28 2023, 7:00 PM
cferris added inline comments.
compiler-rt/lib/scudo/standalone/primary64.h
1016–1032

a

1040

steps

1393

that need to be recycled.

1394

BatchGroups

1395

real

1400–1402

I'm not sure what this is describing. It's not clear what's not implemented. Do you mean the algorithm to release a BatchGroup with the same CompactPtrGroupBase is not done yet?

This revision now requires changes to proceed.Jun 28 2023, 7:00 PM
Chia-hungDuan marked 5 inline comments as done.

Address review comment

Chia-hungDuan added inline comments.Jun 28 2023, 10:39 PM
compiler-rt/lib/scudo/standalone/primary64.h
1400–1402

When there are two BatchGroups with same CompactPtrGroupBase,

For non-BatchClass,

  1. we merge the freelists and release one of the BatchGroups.
  2. call pushBatchClassBlocks to recycle the redundant BatchGroup.

For BatchClass,

  1. we merge the freelists and release one of the BatchGroups. (same as above)
  2. Push the BlockGroup into the merged freelist directly

It can't use pushBatchClassBlocks because we are manipulating the freelist of BatchClass.

I paraphrased it a little bit.

cferris accepted this revision.Jun 29 2023, 3:26 PM

LGTM.

This revision is now accepted and ready to land.Jun 29 2023, 3:26 PM
Chia-hungDuan added inline comments.Jul 11 2023, 1:03 PM
compiler-rt/lib/scudo/standalone/primary64.h
1438–1439

This has to be done because when we determine if we can do range marking, it supposes only the first TransferBatch may not be full. Now this breaks the invariant.

Will revert this change first