Closed Bug 1947687 Opened 1 year ago Closed 1 year ago

MayPurgeStep takes the lock a second time after purging an arena.

Categories

(Core :: Memory Allocator, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: pbone, Assigned: pbone)

References

Details

Attachments

(8 files, 2 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

moz_may_purge_one_now takes the lock again to "peek" to determine if there are more purge requests queued. It's better to return true if there "may be" more requests and let the caller call Purge() again if it wants to.

Summary: MayPurgeOneNow takes the lock twice after purging an arena. → MayPurgeStep takes the lock twice after purging an arena.
Assignee: nobody → pbone
Status: NEW → ASSIGNED

Processing purge requests won't fail if there are none, so there's no point
peeking before attempting to process any.

Summary: MayPurgeStep takes the lock twice after purging an arena. → MayPurgeStep takes the lock a second time after purging an arena.
Attachment #9465883 - Attachment description: Bug 1947687 - Don't peek before processing pending purge requests r=smaug → Bug 1947687 - Don't peek before processing pending purge requests r=jstutte
Depends on: 1920451
Attachment #9465654 - Attachment is obsolete: true
Attachment #9467330 - Attachment description: Bug 1947687 - Correct a comment r=glandium → Bug 1947687 - Correct some comments r=glandium
Attachment #9465883 - Attachment description: Bug 1947687 - Don't peek before processing pending purge requests r=jstutte → Bug 1947687 - Simplify some code with a do-while loop r=jstutte

This avoids releasing the lock only to acquire it a few lines later.

Attachment #9466098 - Attachment is obsolete: true
Blocks: 1950757
Duplicate of this bug: 1950757
Attachment #9467330 - Attachment description: Bug 1947687 - Correct some comments r=glandium → Bug 1947687 - pt 1. Correct some comments r=glandium
Attachment #9467331 - Attachment description: Bug 1947687 - found is already known to be true here r=glandium → Bug 1947687 - pt 2. found is already known to be true here r=glandium
Attachment #9467904 - Attachment description: Bug 1947687 - Remove the arena from the list while we still hold the lock r=jstutte → Bug 1947687 - pt 3. Remove the arena from the list while we still hold the lock r=jstutte
Attachment #9465883 - Attachment description: Bug 1947687 - Simplify some code with a do-while loop r=jstutte → Bug 1947687 - pt 4. Simplify some code with a do-while loop r=jstutte
Attachment #9465884 - Attachment description: Bug 1947687 - Perform multiple purge steps without checking the list r=glandium → Bug 1947687 - pt 6. Perform multiple purge steps without checking the list r=glandium
Pushed by pbone@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/589e781f35c2 pt 1. Correct some comments r=glandium https://hg.mozilla.org/integration/autoland/rev/e128af5f021f pt 2. found is already known to be true here r=glandium https://hg.mozilla.org/integration/autoland/rev/0f2a907ba40a pt 3. Remove the arena from the list while we still hold the lock r=jstutte https://hg.mozilla.org/integration/autoland/rev/c13b82d1c924 pt 4. Simplify some code with a do-while loop r=jstutte https://hg.mozilla.org/integration/autoland/rev/816244cab3f5 pt 5. Move the purge API between sections of malloc_decls.h r=glandium https://hg.mozilla.org/integration/autoland/rev/9012bfccb2cd pt 6. Perform multiple purge steps without checking the list r=glandium

The dirty page functions only make sense with MOZ_MEMORY, without it they're
no-ops. A later patch will move them to a more appropriate section of
malloc_decls.h which will make the undefined without MOZ_MEMORY. Therefore
this patch ifdef's out code that uses them if MOZ_MEMORY isn't defined.

The patch also makes these file-local functions static.

Another patch will move moz_set_max_dirty_page_modifier() into a different
section of malloc_decls.h where it will be unavailable without defining
MOZ_MEMORY. This patch places #ifdefs around some of its uses.

Attachment #9469893 - Attachment description: Bug 1947687 - pt 5. Move the purge API between sections of malloc_decls.h r=glandium → Bug 1947687 - pt 7. Move the purge API between sections of malloc_decls.h r=glandium
Attachment #9465884 - Attachment description: Bug 1947687 - pt 6. Perform multiple purge steps without checking the list r=glandium → Bug 1947687 - pt 8. Perform multiple purge steps without checking the list r=glandium
Pushed by pbone@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/aaf41eb3d828 pt 1. Correct some comments r=glandium https://hg.mozilla.org/integration/autoland/rev/f320b975ef05 pt 2. found is already known to be true here r=glandium https://hg.mozilla.org/integration/autoland/rev/791361c24764 pt 3. Remove the arena from the list while we still hold the lock r=jstutte https://hg.mozilla.org/integration/autoland/rev/b2dec082e21a pt 4. Simplify some code with a do-while loop r=jstutte https://hg.mozilla.org/integration/autoland/rev/31e229ff65b0 pt 5. Move the dirty page modifier code into #ifdefs r=nical https://hg.mozilla.org/integration/autoland/rev/dd640a024c06 pt 6. ifdef out use of moz_set_max_dirty_page_modifier() r=smaug https://hg.mozilla.org/integration/autoland/rev/de6152e95629 pt 7. Move the purge API between sections of malloc_decls.h r=glandium https://hg.mozilla.org/integration/autoland/rev/e35dca5c1c1e pt 8. Perform multiple purge steps without checking the list r=glandium
Blocks: 1950041
Flags: needinfo?(pbone)
Regressions: 1955406
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: