RESOLVED FIXED 234091
Reduce maximum mmap size for Structure regions to help placate ios
https://bugs.webkit.org/show_bug.cgi?id=234091
Summary Reduce maximum mmap size for Structure regions to help placate ios
Keith Miller
Reported 2021-12-09 10:57:12 PST
Reduce maximum mmap size for Structure regions to help placate ios
Attachments
Patch (3.98 KB, patch)
2021-12-09 11:02 PST, Keith Miller
ews-feeder: commit-queue-
Patch (4.00 KB, patch)
2021-12-09 11:10 PST, Keith Miller
ews-feeder: commit-queue-
Patch for landing (4.02 KB, patch)
2021-12-09 11:16 PST, Keith Miller
ews-feeder: commit-queue-
Patch for landing (4.01 KB, patch)
2021-12-09 12:38 PST, Keith Miller
ews-feeder: commit-queue-
Patch for landing (4.75 KB, patch)
2021-12-09 12:57 PST, Keith Miller
ews-feeder: commit-queue-
Patch for landing (3.54 KB, patch)
2021-12-09 13:55 PST, Keith Miller
no flags
Patch for landing (3.57 KB, patch)
2021-12-10 05:36 PST, Keith Miller
no flags
Keith Miller
Comment 1 2021-12-09 11:02:19 PST
Keith Miller
Comment 2 2021-12-09 11:10:51 PST
Saam Barati
Comment 3 2021-12-09 11:10:54 PST
Comment on attachment 446568 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446568&action=review r=me > Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:93 > + void* aligned = nullptr; let's call this "result" or similar, maybe "alignedResult". > Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:95 > + bool copy = false; > + int flags = VM_FLAGS_ANYWHERE; constexpr > Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:97 > + kern_return_t result = mach_vm_map(mach_task_self(), reinterpret_cast<mach_vm_address_t*>(&aligned), bytes, bytes - 1, flags, MEMORY_OBJECT_NULL, 0, copy, protections, protections, childProcessInheritance); bitwise_cast Also, this code is wrong if not a power of 2, right? Should we assert we're dealing with a power of 2? > Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:104 > +#if HAVE(MADV_FREE_REUSE) > + if (aligned) { > + // To support the "reserve then commit" model, we have to initially decommit. > + while (madvise(aligned, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { } > + } > +#endif Can we abstract this since we have a similar loop elsewhere? > Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:106 > + return reinterpret_cast<void*>(aligned); bitwise_cast
Saam Barati
Comment 4 2021-12-09 11:12:06 PST
Comment on attachment 446571 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446571&action=review r=me still with comment from prior patch > Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:83 > + UNUSED_PARAM(includesGuardPages); should we assert we're not dealing with this?
Keith Miller
Comment 5 2021-12-09 11:15:53 PST
Comment on attachment 446568 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446568&action=review >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:93 >> + void* aligned = nullptr; > > let's call this "result" or similar, maybe "alignedResult". I'll rename it to address. >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:95 >> + int flags = VM_FLAGS_ANYWHERE; > > constexpr sure. >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:97 >> + kern_return_t result = mach_vm_map(mach_task_self(), reinterpret_cast<mach_vm_address_t*>(&aligned), bytes, bytes - 1, flags, MEMORY_OBJECT_NULL, 0, copy, protections, protections, childProcessInheritance); > > bitwise_cast > > Also, this code is wrong if not a power of 2, right? > > Should we assert we're dealing with a power of 2? Yeah the assert at the top of the function checks that and that the bytes is bigger than page size. >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:104 >> +#endif > > Can we abstract this since we have a similar loop elsewhere? That seems like more code than we save. >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:106 >> + return reinterpret_cast<void*>(aligned); > > bitwise_cast I can actually delete this.
Keith Miller
Comment 6 2021-12-09 11:16:29 PST
Created attachment 446574 [details] Patch for landing
EWS
Comment 7 2021-12-09 11:59:31 PST
Patch 446574 does not build
Keith Miller
Comment 8 2021-12-09 12:38:06 PST
Created attachment 446589 [details] Patch for landing
Keith Miller
Comment 9 2021-12-09 12:57:19 PST
Created attachment 446594 [details] Patch for landing
Keith Miller
Comment 10 2021-12-09 13:55:09 PST
Created attachment 446601 [details] Patch for landing
Saam Barati
Comment 11 2021-12-09 14:35:54 PST
(In reply to Keith Miller from comment #5) > Comment on attachment 446568 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=446568&action=review > > >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:93 > >> + void* aligned = nullptr; > > > > let's call this "result" or similar, maybe "alignedResult". > > I'll rename it to address. > > >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:95 > >> + int flags = VM_FLAGS_ANYWHERE; > > > > constexpr > > sure. > > >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:97 > >> + kern_return_t result = mach_vm_map(mach_task_self(), reinterpret_cast<mach_vm_address_t*>(&aligned), bytes, bytes - 1, flags, MEMORY_OBJECT_NULL, 0, copy, protections, protections, childProcessInheritance); > > > > bitwise_cast > > > > Also, this code is wrong if not a power of 2, right? > > > > Should we assert we're dealing with a power of 2? > > Yeah the assert at the top of the function checks that and that the bytes is > bigger than page size. > > >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:104 > >> +#endif > > > > Can we abstract this since we have a similar loop elsewhere? > > That seems like more code than we save. > > >> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:106 > >> + return reinterpret_cast<void*>(aligned); > > > > bitwise_cast > > I can actually delete this. Not all of these changes were made.
Saam Barati
Comment 12 2021-12-09 14:37:29 PST
Comment on attachment 446568 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446568&action=review >>> Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp:104 >>> +#endif >> >> Can we abstract this since we have a similar loop elsewhere? > > That seems like more code than we save. that's not always the reason to abstract stuff like this. It's nice to have a shared implementation IMO because of the looping we do.
EWS
Comment 13 2021-12-09 14:57:24 PST
Committed r286804 (245044@main): <https://commits.webkit.org/245044@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 446601 [details].
Radar WebKit Bug Importer
Comment 14 2021-12-09 14:58:25 PST
Ryan Haddad
Comment 15 2021-12-09 16:47:56 PST
Reverted r286804 for reason: Breaks internal builds. Committed r286818 (245054@trunk): <https://commits.webkit.org/245054@trunk>
Keith Miller
Comment 16 2021-12-10 05:36:45 PST
Created attachment 446714 [details] Patch for landing
EWS
Comment 17 2021-12-10 06:29:46 PST
Committed r286849 (245082@main): <https://commits.webkit.org/245082@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 446714 [details].
Note You need to log in before you can comment on or make changes to this bug.