Closed Bug 1987055 Opened 10 months ago Closed 7 months ago

Add a 'logical' page size for mozjemalloc

Categories

(Core :: Memory Allocator, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
147 Branch
Tracking Status
firefox147 --- fixed

People

(Reporter: pbone, Assigned: pbone)

References

(Blocks 1 open bug)

Details

Attachments

(6 files)

Splitting Bug 1980056 into separate phases. This change adds the concept of a logical page size separate from physical page size, but doesn't otherwise change configuration.

Arenas track dirty chunks in a red-black tree ordered by memory address.
Switching this to a list will make it faster to test if an item is in
the list, which is required by the next patch.

Additionally there's no reason this collection needs to be ordered or
support lookups. The ordering by memory address may have some
fragmentation benefits, the new list is operated as a FIFO. Items are
appended at the tail when they get their first dirty page, and removed
from the head as they're purged.

Currently a dirty chunk (that's a chunk with at least one dirty page)
must:

  • Be in mChunksDirty
  • Be busy pruging by another thread.

The next change will allow it so that chunks with a non-zero mNumDirty
might not be in the dirty chunks list because its impossible to purge
their pages. Therefore in this change we relax the above assumption.

Mozjemalloc now has a concept of logical page size for its own
structures that may be different from the system's page size.

Make purging smarter around edge cases. If the first or last dirty page
is not aligned with the hardware page size it will now attempt to purge
extra clean (but unused!) pages in order to capture the dirty pages.

This change also replaces some modulus operators with bitmasks.

Attachment #9511902 - Attachment description: WIP: Bug 1987055 - pt 1. Correct a comment → Bug 1987055 - pt 1. Correct a comment r=glandium
Attachment #9511903 - Attachment description: WIP: Bug 1987055 - pt 2. Merge purge results, ReachedThreshold and Busy → Bug 1987055 - pt 2. Merge purge results, ReachedThreshold and Busy r=glandium
Attachment #9511904 - Attachment description: WIP: Bug 1987055 - pt 3. Change the dirty chunks tree to a list → Bug 1987055 - pt 3. Change the dirty chunks tree to a list r=glandium
Attachment #9511905 - Attachment description: WIP: Bug 1987055 - pt 4. mChunksDirty doesn't always track all dirty chunks → Bug 1987055 - pt 4. mChunksDirty doesn't always track all dirty chunks r=glandium
Attachment #9511906 - Attachment description: WIP: Bug 1987055 - pt 5. Add a 'logical' page size → Bug 1987055 - pt 5. Add a 'logical' page size r=glandium
Attachment #9511907 - Attachment description: WIP: Bug 1987055 - pt 6. Better purging edge cases → Bug 1987055 - pt 6. Better purging edge cases r=glandium
Attachment #9511906 - Attachment description: Bug 1987055 - pt 5. Add a 'logical' page size r=glandium → Bug 1987055 - pt 5. Add a 'logical' page size r=glandium!,mstage!
Blocks: 2003975
QA Whiteboard: [qa-triage-done-c148/b147]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: