WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
181425
bmalloc allocation should be able to round up to next power of two but not commit everything
https://bugs.webkit.org/show_bug.cgi?id=181425
Summary
bmalloc allocation should be able to round up to next power of two but not co...
JF Bastien
Reported
2018-01-08 22:20:23 PST
We're currently moving some allocations to be rounded up to the next power of two. That's easy to tell bmalloc and manager ourselves, but it over-commits memory. If we don't touch it, and it wasn't recycled (likely to happen since usually large) then we're fine, it's not actually mapped. But in the use cases we're going for we *dont't* know whether it was recycled memory or not so we have to initialize that extra memory lest there be old data that turns out to be useful in there (say, observable through speculative execution). It would be great if we could ask bmalloc: 1. Give me `size` memory, rounded up to the next power of 2, and tell me how much of it is actually committed. 2. Reallocate memory that was allocated this way, either committing from the tail (and telling me where the new committed allocation ends), or moving and doing as 1. above. This would be a new API where the caller can know: A. The size that they say the would actually use. B. The committed slack after this size (which must be committed because size isn't necessarily on a page boundary). That slack isn't meant to be used, but the caller wants to manually initialize it so that speculation can be constrained. C. The virtually-reserved but un-committed tail (which is just the next power of two). This part doesn't need to be initialized to anything because speculation will end when it encounters unmapped pages. Let's annotate with FIXMEs all places where we just over-allocate for now, and go back to fix them later with this API.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2018-01-08 22:21:08 PST
<
rdar://problem/36369165
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug