Given the memory group, we are unlikely to need a huge page map to
record entire region. This CL reduces the size of default page map
buffer from 2048 to 512 and increase the number of static buffers to 2.
Details
- Reviewers
cferris cryptoad - Commits
- rGc514198e4d39: [scudo] Adjust page map buffer size
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
A couple of nits, but one question about the design.
Also, it would be good to include the data you gathered about the sizes needed to show that the 512 size was not grabbed completely out of the air.
compiler-rt/lib/scudo/standalone/release.h | ||
---|---|---|
69 | Would it make sense to change this to a try lock? Because if you are stuck waiting for another thread to finish, it might take more time than falling back to doing the mmap. Using the try lock should be fast and avoid blocking multiple threads trying to get a block. | |
118–121 | I know this is pulled from the previous code, but the comment should reference that this is only done for Fuchsia. We might want to say that it hasn't proven a performance benefit on other platforms. | |
129 | This is slightly confusing. Maybe something like a '1' means that buffer index is not used. '0' means the buffer is in use. |
compiler-rt/lib/scudo/standalone/release.h | ||
---|---|---|
69 | Add comment and move the getDynamicBuffer() out the lock acquiring scope. |
The size is determined by collecting the buffer usage from several apps and we didn't see them over 256, most of them are smaller than 100. With partial range releasing, the required buffer size is even smaller. The following is a sample with buffer size grater than 200. It's 15 out of 312 buffer usages.
I scudo : AllocatedUser = 28734656, Origin Buffer Size = 220, Optimized BufferSize = 177 I scudo : AllocatedUser = 28734656, Origin Buffer Size = 220, Optimized BufferSize = 17 I scudo : AllocatedUser = 28734656, Origin Buffer Size = 220, Optimized BufferSize = 81 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 5 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 173 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 25 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 181 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 33 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 9 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 177 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 89 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 177 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 9 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 41 I scudo : AllocatedUser = 29947696, Origin Buffer Size = 229, Optimized BufferSize = 41
Would it make sense to change this to a try lock? Because if you are stuck waiting for another thread to finish, it might take more time than falling back to doing the mmap. Using the try lock should be fast and avoid blocking multiple threads trying to get a block.