WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
295104
[bmalloc] Use madvise(MADV_ZERO) instead of mmap
https://bugs.webkit.org/show_bug.cgi?id=295104
Summary
[bmalloc] Use madvise(MADV_ZERO) instead of mmap
Marcus Plutowski
Reported
2025-06-27 08:53:06 PDT
rdar://154496366
When zeroing sufficiently large regions in libpas, we currently use mmap to make the OS give us new pages (instead of having to memset them ourselves). On Darwin, however, this approach is pessimizing in many cases (e.g. the page is still in lazy-zero-fill state, and so notionally could just be left in-place), and moreover causes issues with fragmentation inside the kernel that we want to avoid. The better alternative is to use madvise(p, sz, MADV_ZERO) whenever possible. This is not supported on Linux or older Darwin versions, so we will need to check for the presence of MADV_ZERO. Moreover, madvise can sometimes fail (e.g. for CoW pages), so we need to still support mmap as a fallback.
Attachments
Add attachment
proposed patch, testcase, etc.
Marcus Plutowski
Comment 1
2025-06-27 10:32:48 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/47308
EWS
Comment 2
2025-06-28 10:04:48 PDT
Committed
296771@main
(1747d6d1de6d): <
https://commits.webkit.org/296771@main
> Reviewed commits have been landed. Closing PR #47308 and removing active labels.
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