Closed Bug 1699224 Opened 4 years ago Closed 4 years ago

Support remapping shared surfaces when there is virtual memory pressure

Categories

(Core :: Graphics: WebRender, defect, P3)

defect

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox86 --- wontfix
firefox87 --- wontfix
firefox88 --- wontfix
firefox89 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

(Blocks 3 open bugs, Regressed 1 open bug)

Details

Attachments

(5 files)

For 32-bit users, primarily Windows and Android, encounter OOMs due to low virtual memory address space a lot. If we could unmap the largest least recently used images when we hit memory pressure, and remap them on demand, that would likely help a lot. This would be similar to the volatile memory efforts without WebRender, but without relying upon an OS mechanism to do it.

Severity: S3 → S2
See Also: → 1645841
Blocks: 1683284

Since we want to be able to unmap shared surfaces which are not in use,
we need to be able to map the data in as required. Blob images can
access shared surfaces via recordings which are used by DrawTargetSkia.
This patch makes it call Map/Unmap for data surfaces that require a data
pointer in Skia.

This patch exposes SharedMemoryBasic::Unmap for use by callers to allow
one to unmap memory out of our address space without destroying the
SharedMemoryBasic object itself. This will be used by later patches in
this series.

We want to use nsExpirationTracker to decide when we should unmap shared
surfaces from our address space. This relies upon the observer service
and we need to be both initialized and shutdown on the main thread to
add/remove the observer. SharedSurfacesParent is already initialized on
the main thread, and we just need to complete shutdown on the main
thread.

This patch adds an expiration tracker to decide when to unmap unused
shared surfaces from our address space to reclaim virtual memory. This
is only used on 32-bit builds of Firefox where there is meaningful
virtual address space pressure.

Before we start a resource update, we should check if we are virtual
memory pressured (32-bit Windows only). If so, pre-emptively unmap
shared surfaces until the pressure is relieved to try to avoid OOMs
elsewhere. This only applies to the GPU process because the parent
process actively watches its own memory pressure and dispatches a
low-memory event which our expiration tracker is an observer for.

Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f8b232382361 Part 1. Ensure we map/unmap surfaces used by DrawTargetSkia. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/8ce6ddf6ec6f Part 2. Expose SharedMemoryBasic::Unmap for use by callers. r=jld https://hg.mozilla.org/integration/autoland/rev/85f3499080db Part 3. Complete shutdown of SharedSurfacesParent on the main thread. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/36bf68e01a50 Part 4. Allow shared surfaces to be mapped and unmapped on demand. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/f929f9783e61 Part 5. Unmap shared surfaces if memory pressured during resource updates. r=jrmuizel

Ugh, merge conflict error.

Flags: needinfo?(aosmond)
Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d2294fe6ef31 Part 1. Ensure we map/unmap surfaces used by DrawTargetSkia. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/ef3ef367986e Part 2. Expose SharedMemoryBasic::Unmap for use by callers. r=jld https://hg.mozilla.org/integration/autoland/rev/206187cafb6f Part 3. Complete shutdown of SharedSurfacesParent on the main thread. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/94c75dba6545 Part 4. Allow shared surfaces to be mapped and unmapped on demand. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/bc232de0c5f8 Part 5. Unmap shared surfaces if memory pressured during resource updates. r=jrmuizel
Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/66b86bed3d06 Part 1. Ensure we map/unmap surfaces used by DrawTargetSkia. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/9aac5a079130 Part 2. Expose SharedMemoryBasic::Unmap for use by callers. r=jld https://hg.mozilla.org/integration/autoland/rev/db4b82029686 Part 3. Complete shutdown of SharedSurfacesParent on the main thread. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/cd7cfc8fc140 Part 4. Allow shared surfaces to be mapped and unmapped on demand. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/1646c323910d Part 5. Unmap shared surfaces if memory pressured during resource updates. r=jrmuizel
Depends on: 1702132
Regressions: 1702132
No longer depends on: 1702132
Flags: needinfo?(aosmond)
Regressions: 1714681
Regressions: 1709679
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: