Commit Graph

548 Commits

Author SHA1 Message Date
Ray Kraesig
b90e6da27e Bug 1785162 - Allow child-process half-stalls to ride the trains r=glandium,gsvelto
The past couple of weeks of crash telemetry indicate that stalling on
OOM in child processes for half as long as in main processes drastically
reduces child process OOM crashes without noticeably increasing
main-process OOM crashes.

Give it a ticket and send it on its way.

Differential Revision: https://phabricator.services.mozilla.com/D158790
2022-10-07 15:40:24 +00:00
Ray Kraesig
310ef2663b Bug 1785162 - [3/3] stall for half time in non-main processes r=gsvelto
Retain the full stall period in the main process; stall for only half as
long in all other processes.

Differential Revision: https://phabricator.services.mozilla.com/D157140
2022-09-22 15:01:42 +00:00
Ray Kraesig
adac61618a Bug 1785162 - [2/3] refactor to specify stall count and time r=glandium,gsvelto
Refactor to allow specifying a potentially variable stall-count and
-time, rather than a binary stall/don't-stall cue.

No functional changes; this facility will actually be used in the next
commit.

Differential Revision: https://phabricator.services.mozilla.com/D157139
2022-09-22 15:01:42 +00:00
Ray Kraesig
f30c547ca5 Bug 1785162 - [1/3] Revert "Disable all-process stalling in Nightly" r=gsvelto
Sufficient data has been acquired to confirm that all-stall does indeed
increase the chance of a main-process OOM compared to just main-stall.

Revert to all-stall anyway, solely to simplify the next two commits.

Differential Revision: https://phabricator.services.mozilla.com/D157138
2022-09-22 15:01:42 +00:00
Ray Kraesig
75b7dee465 Bug 1207753 - Add TS annotations for some mozjemalloc mutexes r=jesup
Add thread-safety annotations for a few of the mutexes in mozjemalloc.

Differential Revision: https://phabricator.services.mozilla.com/D157858
2022-09-22 15:00:44 +00:00
Ray Kraesig
dbdb9db19d Bug 1785162 - Disable all-process stalling in Nightly r=gsvelto
A recent patch for bug 965392 (now reverted) may have been causing
additional memory use and OOM-crashes. To confirm this, temporarily(?)
revert all-process stalling on Nightly to the main-process-only version
active between 2022-07-28 and 2022-08-25, to collect a few days' worth of
telemetry.

On Beta and later, there are no functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D157124
2022-09-13 18:34:43 +00:00
Ray Kraesig
709d56796c Bug 1785162 - Always stall on OOM on Windows in Nightly r=gsvelto
It's suspected that this may induce performance regressions. Do it
anyway, just to find out how bad it is. (But only on Nightly, for now.)

For simplicity's sake, this does not include any additional telemetry;
the decision of whether and what any additional telemetry is needed will
be deferred until we have some feedback from what we've already got.

Differential Revision: https://phabricator.services.mozilla.com/D155301
2022-08-25 19:35:32 +00:00
Ray Kraesig
613c6089f5 Bug 1716727 - patchset #3 [1/1] - Cleanup: remove intermediate function r=glandium
Since mozglue is now aware of Gecko process-types, remove the
configurator for this bug's associated experiment. Instead, use
`GeckoProcessType` directly in mozjemalloc.

This requires a couple of adjustments for non-Firefox uses of
mozjemalloc:

- Since `logalloc-replay` uses mozjemalloc in an odd way, tweak its
  `moz.build` to also include `mozglue/misc/ProcessType.cpp`.
- Since `GeckoProcessType` is not available in standalone SpiderMonkey
  builds, make the mostly-arbitrarily choice to always stall there.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D155300
2022-08-25 14:44:47 +00:00
Gabriele Svelto
44cbaf4248 Bug 1784018 - Remove deprecated OSSpinLocks r=glandium
On macOS versions prior to 10.15 os_unfair_locks cannot spin in kernel-space
which degrades performance significantly. To obviate for this we spin in
user-space like OSSpinLock does, for the same number of times and invoking
x86-specific pause instructions in-between the locking attempts to avoid
starving a thread that might be running on the same physical core.

Differential Revision: https://phabricator.services.mozilla.com/D154205
2022-08-24 09:18:57 +00:00
Ray Kraesig
52e0d53fb0 Bug 1716727 - patchset #2 [2/2] Deexperimentalize stalling code r=glandium
Although further experiments and refinements are called for, the effect
of this patch has been overall significantly positive. Let it ride the
trains as-is for Fx 105, rather than blocking on those experiments.

(This patch conflicts with D153784, which will need to be rebased and
moved to a new Bugzilla bug.)

Depends on D153783

Differential Revision: https://phabricator.services.mozilla.com/D154839
2022-08-18 20:32:26 +00:00
Ray Kraesig
b70021268a Bug 1716727 - patchset #2 [1/2] - Assorted minor cleanup r=glandium,bobowen
Since the plausible timeframe for immediate panicked reversion of the
previous patchset has passed without incident, unpin and clean up the
remaining uses of `sChildProcessType` from nsEmbedFunctions.cpp.

Additionally, get rid of the rump declaration of `..._set_always_stall`
on non-Windows builds.

No functional changes.

(Reference: bug 1682520, D152198.)

Differential Revision: https://phabricator.services.mozilla.com/D153783
2022-08-18 20:32:26 +00:00
Fabrice Desré
c50cb528fc Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 16:39:41 +00:00
Andreea Pavel
3ccd75af8d Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel
fdb7cb2ecd Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 15:27:43 +00:00
Andreea Pavel
89d63c91e6 Backed out changeset a907159a482f (bug 1761040) for causing build bustages on a CLOSED TREE 2022-08-02 04:59:08 +03:00
Fabrice Desré
0f4ac7ad97 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-02 00:49:41 +00:00
Ray Kraesig
5f25d69d33 Bug 1782027 - Fix bustage in simulated early-beta Windows builds r=gcp
... which was entirely due to a trivial error on my part.

Differential Revision: https://phabricator.services.mozilla.com/D153109
2022-07-28 19:11:20 +00:00
Ray Kraesig
a63e2430bf Bug 1716727 - [3/3] make stalling behavior conditional on process type r=glandium
For now, make Set_XREProcessType set a flag in mozjemalloc to avoid
stalling repeatedly in auxiliary processes.

Differential Revision: https://phabricator.services.mozilla.com/D151332
2022-07-27 19:54:36 +00:00
Ray Kraesig
44a45dc8a5 Bug 1716727 - [2/3] OOM handling: stall and retry r=glandium,gsvelto
Implement a drop-in-replacement wrapper for `VirtualAlloc` which, rather
than returning immediately on failure, instead `::Sleep()`s and retries.

This will cause performance regressions in some (presumed-uncommon)
circumstances; this wrapper is therefore only enabled in Nightly, to
collect data on its efficacy and on the severity of those regressions.

Differential Revision: https://phabricator.services.mozilla.com/D150619
2022-07-27 19:54:36 +00:00
Ray Kraesig
ca8b982e11 Bug 1716727 - [1/3] Drive-by cleanup: clang-tidy nitpicks r=glandium
Some trivially-resolvable nitpicks pointed out by clang-tidy.

Differential Revision: https://phabricator.services.mozilla.com/D150618
2022-07-27 19:54:35 +00:00
Butkovits Atila
1402637e8b Backed out 3 changesets (bug 1716727) for causing build bustages. CLOSED TREE
Backed out changeset 11fb3262cccb (bug 1716727)
Backed out changeset 895ad6545236 (bug 1716727)
Backed out changeset c0fd4f429cd8 (bug 1716727)
2022-07-27 04:01:16 +03:00
Ray Kraesig
4ec2a2d0b4 Bug 1716727 - [3/3] make stalling behavior conditional on process type r=glandium
For now, make Set_XREProcessType set a flag in mozjemalloc to avoid
stalling repeatedly in auxiliary processes.

Differential Revision: https://phabricator.services.mozilla.com/D151332
2022-07-27 00:30:04 +00:00
Ray Kraesig
55f93cc62f Bug 1716727 - [2/3] OOM handling: stall and retry r=glandium,gsvelto
Implement a drop-in-replacement wrapper for `VirtualAlloc` which, rather
than returning immediately on failure, instead `::Sleep()`s and retries.

This will cause performance regressions in some (presumed-uncommon)
circumstances; this wrapper is therefore only enabled in Nightly, to
collect data on its efficacy and on the severity of those regressions.

Differential Revision: https://phabricator.services.mozilla.com/D150619
2022-07-27 00:30:04 +00:00
Ray Kraesig
1b26c65a01 Bug 1716727 - [1/3] Drive-by cleanup: clang-tidy nitpicks r=glandium
Some trivially-resolvable nitpicks pointed out by clang-tidy.

Differential Revision: https://phabricator.services.mozilla.com/D150618
2022-07-27 00:30:03 +00:00
Paul Bone
7a49f8892c Bug 1742828 - Enable more aggressive allocation packing on MacOS r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D139800
2022-07-26 23:54:17 +00:00
Ray Kraesig
1f4a9dd483 Bug 1207753 - add thread-safety annotations to memory/build's Mutex types r=glandium,jesup
Add the customary bevy of thread-safety annotations to the Mutex types
in memory/build.

Almost all existing instances of these Mutexes are already marked with
MOZ_UNANNOTATED, but this turns out not to matter: MOZ_UNANNOTATED has
no equivalent under clang's `-Wthread-safety` attributes. There are no
variables declared to be guarded by these mutexes, but they must still
be unlocked and relocked in principled ways -- or, alternatively, only
have unverifiable actions taken in appropriately-annotated code.

The primary offenders here are the `pthread_atfork` hooks; these can't
all be annotated precisely (and couldn't be checked even if they were),
so we simply mark them all as unanalyzable. The only other warning is
from a highly unusual (but already well-commented) bit in PHC.cpp where
we manually release an autolocked mutex before crashing.

Differential Revision: https://phabricator.services.mozilla.com/D150519
2022-07-08 21:24:03 +00:00
Gabriele Svelto
7e8fda1a8b Bug 1774458 - Use undocumented, non-public adaptive spinlocks on macOS 10.15+, revert to user-space spinlocks on older versions r=pbone
Differential Revision: https://phabricator.services.mozilla.com/D149599
2022-07-04 14:00:11 +00:00
smolnar
1ae6fdb86e Backed out changeset 6d913c78ba72 (bug 1207753) for causing build bustages in memory/replace/logalloc/LogAlloc.cpp CLOSED TREE 2022-06-30 20:44:00 +03:00
Ray Kraesig
ec7d45d247 Bug 1207753 - add thread-safety annotations to memory/build's Mutex types r=glandium,jesup
Add the customary bevy of thread-safety annotations to the Mutex types
in memory/build.

Almost all existing instances of these Mutexes are already marked with
MOZ_UNANNOTATED, so there's not much else required for this patch. The
sole exception is a highly unusual (but already well-commented) bit in
PHC.cpp where we manually release an autolocked mutex before crashing.

Differential Revision: https://phabricator.services.mozilla.com/D150519
2022-06-30 17:25:28 +00:00
Ryan VanderMeulen
357cb02321 Bug 1776455 - Don't define unused functions on Windows. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D150444
2022-06-29 13:18:22 +00:00
Bogdan Szekely
b1f7582841 Backed out changeset 910652b53350 (bug 1774458) for causing build bustages on Mutex.cpp CLOSED TREE 2022-06-29 11:28:41 +03:00
Gabriele Svelto
6896218e59 Bug 1774458 - Use undocumented, non-public adaptive spinlocks on macOS 10.15+, revert to user-space spinlocks on older versions r=pbone
Differential Revision: https://phabricator.services.mozilla.com/D149599
2022-06-29 08:13:29 +00:00
Marian-Vasile Laza
6f25bc857b Backed out changeset ecea89cb3d35 (bug 1774458) for crashing on macOS 10.14 and older. CLOSED TREE 2022-06-24 01:56:51 +03:00
Gabriele Svelto
de07e630cc Bug 1774458 - Use undocumented, non-public adaptive spinlocks on macOS r=pbone
Differential Revision: https://phabricator.services.mozilla.com/D149599
2022-06-23 20:45:03 +00:00
Gabriele Svelto
8f9904bb76 Bug 1670885 - Replace deprecated NSSpinLocks with os_unfair_locks in the memory allocator r=glandium
Depends on D148287

Differential Revision: https://phabricator.services.mozilla.com/D99280
2022-06-07 07:37:20 +00:00
Randell Jesup
fcaf70841e Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 18:47:08 +00:00
Noemi Erli
2390d257e6 Backed out changeset 12a59e5a50bf (bug 1207753) for causing build bustage CLOSED TREE 2022-03-16 18:32:51 +02:00
Randell Jesup
4b033a5256 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 16:16:14 +00:00
Butkovits Atila
927ad62c6a Backed out changeset a68ee4b09f92 (bug 1207753) for causing Hazard bustages. CLOSED TREE 2022-03-16 14:38:14 +02:00
Randell Jesup
7d4b5fae04 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 12:01:14 +00:00
Zhao Jiazhong
62341514c5 Bug 1756570 - [loong64] Add basic build support for LoongArch64 port. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D139567
2022-02-25 03:42:34 +00:00
Gian-Carlo Pascutto
b936d4f576 Bug 1546442 - Leading guard pages for normal allocations. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D28516
2021-11-26 11:46:25 +00:00
Paul Bone
9a5f36b0dd Bug 1735482 - Don't use a QuantumWide size class on MacOS r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D131576
2021-11-23 02:01:59 +00:00
Iulian Moraru
6cab1c251e Backed out changeset 85fdbf7e368a (bug 1735482) for causing OS X build bustages on mozjemalloc.cpp. CLOSED TREE 2021-11-22 19:01:35 +02:00
Paul Bone
f7d8d8c80e Bug 1735482 - Don't use a QuantumWide size class on MacOS r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D131576
2021-11-22 16:40:52 +00:00
Paul Bone
da23871ca8 Bug 1738240 - Convert the divide function to a template class r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D131197
2021-11-22 01:03:09 +00:00
Paul Bone
62af1f75c2 Bug 1738240 - Use fast-divide for QuantumWide r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D129807
2021-11-22 01:03:08 +00:00
Paul Bone
18f4d35973 Bug 1738240 - Move division routine out of arena_run_reg_dalloc r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D129806
2021-11-22 01:03:08 +00:00
Paul Bone
1a20d57362 Bug 1735250 - Provide a less-magic array size for jemalloc_stats r=glandium
jemalloc_stats takes an array for its second argument.  It expects this
array to have enough space for all the bins, previously the maximum was set
as a magic number.  To make it dependent on the configured bins this patch
replaces the compile-time constant with a function.

Differential Revision: https://phabricator.services.mozilla.com/D127761
2021-10-21 06:42:34 +00:00
Paul Bone
1b721fc414 Bug 1735715 - Handle gMaxSubPageClass == 0 properly r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D128448
2021-10-21 06:03:45 +00:00