Closed Bug 1804499 Opened 1 year ago Closed 1 year ago

Expose stall-and-retry logic for use by other allocators

Categories

(Core :: Memory Allocator, task)

task

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: rkraesig, Assigned: rkraesig)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

In bug 1794059 it was noted that shared memory allocation attempts would also benefit from a stall-and-retry mechanism.

We should probably extract and expose the one from mozjemalloc to avoid duplication of effort.

The real ::VirtualAlloc does not modify the existing last-error code in
case of success; therefore, neither should we.

In bug 1794059 it was noted that the IPC shared-memory allocation code
would like to be able to stall-and-retry as well using the same logic.

While it doesn't use VirtualAlloc, the principle is otherwise the same.
Shuffle the relevant code around so that the stall-and-retry logic is
separate from the allocation, in preparation for exporting it.

Depends on D164105

Extract the stall-and-retry logic to a header.

Additionally, expose and export GetStallSpecs(), so that other memory-
allocation mechanisms can easily remain consistent therewith if desired.

Depends on D164106

Status: NEW → ASSIGNED
Attachment #9307126 - Attachment description: Bug 1804499 - [1/3] Handle Windows error code consistently r?glandium → Bug 1804499 - [1/4] Handle Windows error code consistently r?glandium
Attachment #9307127 - Attachment description: Bug 1804499 - [2/3] Factor out the stall logic in preparation for export r?glandium → Bug 1804499 - [2/4] Factor out the stall logic in preparation for export r?glandium
Attachment #9307128 - Attachment description: Bug 1804499 - [3/3] Expose stall-and-retry code beyond mozjemalloc.cpp r?glandium!,nika → Bug 1804499 - [3/4] Expose stall-and-retry code beyond mozjemalloc.cpp r?glandium!,nika

Export GetStallSpecs as mozilla::GetAllocatorStallSpecs, when it exists.

Depends on D164107

Pushed by rkraesig@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a05c18f43067
[1/4] Handle Windows error code consistently  r=glandium
https://hg.mozilla.org/integration/autoland/rev/180af13cd33f
[2/4] Factor out the stall logic in preparation for export  r=glandium
https://hg.mozilla.org/integration/autoland/rev/3131f330b55d
[3/4] Expose stall-and-retry code beyond mozjemalloc.cpp  r=glandium
https://hg.mozilla.org/integration/autoland/rev/54dd0be202ef
[4/4] Expose allocator's stall-specs beyond mozjemalloc.cpp  r=glandium

A header was incorrectly included only conditionally. Attempting reland following a successful try build.

Flags: needinfo?(rkraesig)
Pushed by rkraesig@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/edb20d240a8a
[1/4] Handle Windows error code consistently  r=glandium
https://hg.mozilla.org/integration/autoland/rev/111bc058d516
[2/4] Factor out the stall logic in preparation for export  r=glandium
https://hg.mozilla.org/integration/autoland/rev/c08d6adb592e
[3/4] Expose stall-and-retry code beyond mozjemalloc.cpp  r=glandium
https://hg.mozilla.org/integration/autoland/rev/6410cf79dcc1
[4/4] Expose allocator's stall-specs beyond mozjemalloc.cpp  r=glandium
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: