Closed Bug 1529922 Opened 6 years ago Closed 6 years ago

Trailing guard pages for huge allocations

Categories

(Core :: Memory Allocator, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox67 --- wontfix
firefox68 --- fixed

People

(Reporter: gcp, Assigned: gcp)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 7 obsolete files)

Split off from bug 1446040. Trailing guard pages for normal allocations are relatively easier, and should be able to land ahead of the rest of the work.

Blocks: 1446040

Changes compared to Matt's original patch:

  1. Make sure guard pages are always applied on non-Windows systems on realloc.
  2. Deal with a nasty edge case where we realloc and now there's no more room for a guard.
  3. Simplify code to remove separate Windows (DECOMMIT) and non-Windows paths.
  4. apply/remove guard calls the (de)commit function so memory gets tagged.
  5. Poison zone between the end of the allocation and the start of the guard.
  6. Fixes for the tests on non-Windows, add test to check for guards when enlarging.
  7. Tiny optimization to zero only the part of the chunk that will be used.
Assignee: nobody → gpascutto

Depends on D21565

Attachment #9046660 - Attachment is obsolete: true
Attachment #9047449 - Attachment description: Bug 1529922 - Part 4: Allow madvise(.., MADV_NORMAL) in the GMP sandbox. r=mhowell!,glandium! → Bug 1529922 - Part 4: Allow madvise(.., MADV_NORMAL) in the GMP sandbox. r=jld
Attachment #9047449 - Attachment description: Bug 1529922 - Part 4: Allow madvise(.., MADV_NORMAL) in the GMP sandbox. r=jld → Bug 1529922 - Part 4: Allow madvise(.., MADV_NORMAL) in the GMP sandbox. r=mhowell!,glandium!
Attachment #9047449 - Attachment description: Bug 1529922 - Part 4: Allow madvise(.., MADV_NORMAL) in the GMP sandbox. r=mhowell!,glandium! → Bug 1529922 - Part 4: Allow madvise(.., MADV_NORMAL) in the GMP sandbox. r=jld!
Attachment #9047445 - Attachment is obsolete: true
Attachment #9047447 - Attachment is obsolete: true
Attachment #9047790 - Attachment is obsolete: true

Hopefully the last try push, to check the final performance and memory impact.

I have an implementation for normal pages done in the way glandium suggested, i.e. by making the DECOMMIT logic the general case and then not allocating the final page during the initial run, together with some fixes to prevent that page being included in coalescing/extending. Need to do some more testing first though.

Depends on D23292

Attachment #9047448 - Attachment description: Bug 1529922 - Part 3: Add a test for guard regions in runs. r=mhowell!,glandium! → Bug 1529922 - Add a test for guard regions in runs. r=glandium
Attachment #9047449 - Attachment is obsolete: true
Summary: Trailing guard pages for normal allocations → Trailing guard pages for huge allocations
Blocks: 1537781
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Attachment #9052180 - Attachment description: Bug 1529922 - Guard pages for normal allocations. r=glandium → Bug 1537781 - Guard pages for normal allocations. r=glandium
Attachment #9047448 - Attachment description: Bug 1529922 - Add a test for guard regions in runs. r=glandium → Bug 1537781 - Add a test for guard regions in runs. r=glandium

Ouch, looks like moz-phab is clueless that the bug has been moved.

Comment on attachment 9052180 [details]
Bug 1537781 - Guard pages for normal allocations. r=glandium

Revision D24135 was moved to bug 1537781. Setting attachment 9052180 [details] to obsolete.

Attachment #9052180 - Attachment is obsolete: true

Comment on attachment 9047448 [details]
Bug 1537781 - Add a test for guard regions in runs. r=glandium

Revision D21566 was moved to bug 1537781. Setting attachment 9047448 [details] to obsolete.

Attachment #9047448 - Attachment is obsolete: true
Depends on: 1539494

glandium, any idea why we saw such a big memory win for this on macOS?

Flags: needinfo?(mh+mozilla)

I think what's happening is that pages_decommit, which now just maps fresh new pages, is better at reducing RSS than when it was using madvise(MADV_FREE).

Flags: needinfo?(mh+mozilla)
Regressions: 1624366
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: