Jens Stutte
542d0e564f
Bug 1924444 - Use a linked list with LIFO policy for a bin's mNotFullRuns to reduce overhead and foster locality. r=smaug,pbone
...
The current order of re-using regions from non-full runs relies on the
run's position in memory via a RedBlackTree. This leads to O(log(n))
complexity for the tree book-keeping and walking while providing a
somewhat arbitrary order when doing GetNonFullBinRun.
We can reduce the complexity here by using a DoublyLinkedList for
mNonFullRuns. The resulting LIFO order seems to have beneficial effects
for common gecko use cases, too.
Differential Revision: https://phabricator.services.mozilla.com/D225533
2024-11-13 07:48:38 +00:00
Jens Stutte
335245d6bc
Bug 1913753 - Add thread safety annotations for AddressRadixTree. r=glandium,pbone
...
Differential Revision: https://phabricator.services.mozilla.com/D219527
2024-11-08 09:02:26 +00:00
Jens Stutte
6cb922b1c9
Bug 1913753 - Add thread safety annotations for ArenaCollection. r=glandium,pbone
...
Differential Revision: https://phabricator.services.mozilla.com/D219526
2024-11-08 09:02:26 +00:00
Jens Stutte
2a78de584d
Bug 1913753 - Add thread safety annotations for arena_t. r=glandium,pbone
...
Differential Revision: https://phabricator.services.mozilla.com/D219493
2024-11-08 09:02:25 +00:00
Jens Stutte
912afc7faa
Bug 1928822 - Adjust assertion for mIsPRNGInitializing case. r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D228189
2024-11-08 08:41:21 +00:00
serge-sans-paille
99b89d001a
Bug 1929263 - Use std::clamp instead of min/max chain in memory/build/PHC.cpp r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D227976
2024-11-06 10:13:48 +00:00
Paul Bone
9c47790587
Bug 1927390 - Use DebugOnly to remove some ifdefs r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D227006
2024-11-06 09:00:40 +00:00
Paul Bone
1b5f2cd4f1
Bug 1927390 - Use 'auto *' for a type r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D226724
2024-11-06 09:00:39 +00:00
Paul Bone
4b50274951
Bug 1488780 - pt 18. Continue purging in the current chunk r=glandium,jstutte
...
The Purge() code would purge some dirty pages in a chunk and then put it
back in the list for a future iteration. This change will hold onto the
chunk and continue purging dirty pages from it until it has none left.
I think (but don't know) that this is closer to the origional code and
could result in better performance by finding larger dirty runs.
Differential Revision: https://phabricator.services.mozilla.com/D223683
2024-11-06 01:46:26 +00:00
Paul Bone
a43a4a86eb
Bug 1488780 - pt 17. Split Purge into seperate functions for each phase r=glandium
...
Splitting this into seperate functions makes control flow and some of the
communication between them clearer.
Differential Revision: https://phabricator.services.mozilla.com/D223684
2024-11-06 01:46:25 +00:00
Paul Bone
efac6c3bca
Bug 1488780 - pt 16. Release chunks outside the arena lock r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D217786
2024-11-06 01:46:25 +00:00
Paul Bone
9c58bcde34
Bug 1488780 - pt 15. Unlock for decommit r=glandium,jstutte
...
Differential Revision: https://phabricator.services.mozilla.com/D217370
2024-11-06 01:46:24 +00:00
Paul Bone
a5d93a1bb1
Bug 1488780 - pt 14. Only allocate into the spare chunk if it's not busy r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D217369
2024-11-06 01:46:24 +00:00
Paul Bone
7779d6b8a4
Bug 1488780 - pt 13. Don't realloc into busy memory r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D217368
2024-11-06 01:46:23 +00:00
Paul Bone
f0caa22359
Bug 1488780 - pt 12. Coalesce runs and delete chunks in Purge() r=glandium
...
A chunk may have been busy and unable to be deleted or a run may have been
unable to be merged due to neighouring busy runs. So when Purge() finishes
it must check if it needs to merge runs or delete the chunk. Note that
merging a run may result in one large empty run which means the chunk must
then become the spare chunk and purge will delete the previous spare chunk -
if any.
Differential Revision: https://phabricator.services.mozilla.com/D217367
2024-11-06 01:46:23 +00:00
Paul Bone
f720fca433
Bug 1488780 - pt 11. Move Coaleascing code out of DallocRun r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D217366
2024-11-06 01:46:23 +00:00
Paul Bone
be1562b5c0
Bug 1488780 - pt 10. Don't merge busy runs r=glandium
...
When a run of pages is freed don't merge it with adjacent busy runs
Differential Revision: https://phabricator.services.mozilla.com/D217365
2024-11-06 01:46:22 +00:00
Paul Bone
fa35781fc6
Bug 1488780 - pt 9. Don't allocate runs with busy pages r=glandium
...
+ Mark runs as busy by marking their first and last page
* Remove busy runs from mAvailRuns during purge
* Assert that when deleting a chunk, the chunk's first and only run isn't
busy.
* SplitRun will now assert if it encounters a busy page.
Differential Revision: https://phabricator.services.mozilla.com/D217248
2024-11-06 01:46:22 +00:00
Paul Bone
db5ba2902e
Bug 1488780 - pt 8. Mark pages busy during the purge operation r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D217247
2024-11-06 01:46:21 +00:00
Paul Bone
459c6836c2
Bug 1488780 - pt 7. Remove busy chunks from dirty list during purge r=glandium
...
The easiest way to avoid multiple threads from trying to purge the same
memory is to remove the chunk being purged from the list of dirty chunks.
It can be re-added later if it has any dirty pages remaining.
Although this may prevent another thread from purging some memory, at least
immediately, it will make following patches easier to implement.
This also means that Purge() may not find a chunk to purge memory from even
if there is dirty memory.
Differential Revision: https://phabricator.services.mozilla.com/D217246
2024-11-06 01:46:21 +00:00
Paul Bone
cf761de0ed
Bug 1488780 - pt 6. Make Purge() and RemoveChunk() safe to run concurrently r=glandium
...
* Add a mDying flag to Chunks
* After Purge(), if a chunk is dying don't add it to structures such as
mChunksMadvised
* Add a mHasBusyPages flag to Chunks
* Don't delete busy chunks
* Instead in Purge() if a chunk has a mDying set then Purge is responsible
for finishing the deletion.
Differential Revision: https://phabricator.services.mozilla.com/D217245
2024-11-06 01:46:21 +00:00
Paul Bone
f98dd6456b
Bug 1488780 - pt 5. Don't insert then remove an empty chunk's run r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D217244
2024-11-06 01:46:20 +00:00
Paul Bone
5c3d10de0f
Bug 1488780 - pt 4. Refactor DeallocChunk r=glandium
...
* Rename DeallocChunk to PrepareRemoveChunk,
* Move chunk removal code into a new function RemoveChunk
Differential Revision: https://phabricator.services.mozilla.com/D217243
2024-11-06 01:46:20 +00:00
Paul Bone
058c04a13d
Bug 1488780 - pt 3. Split Purge() into three phases r=glandium
...
A future patch will lock only the first and third phases. Until then this
change will make the next few patches easier to read.
Differential Revision: https://phabricator.services.mozilla.com/D217242
2024-11-06 01:46:19 +00:00
Paul Bone
0c7d2f8cae
Bug 1488780 - pt 2. Move Purge() out of the arena lock r=glandium,jstutte
...
Purge() will now take the lock itself. It must not be called with the lock
held and therefore this patch moves calls to Purge until after the lock is
released.
Differential Revision: https://phabricator.services.mozilla.com/D217241
2024-11-06 01:46:19 +00:00
Paul Bone
e8bfcdf547
Bug 1488780 - pt 1. Make Purge() a one-shot operation r=glandium,jstutte
...
Differential Revision: https://phabricator.services.mozilla.com/D217240
2024-11-06 01:46:19 +00:00
Sylvestre Ledru
cd289bcb06
Bug 1921433 - reformat with black 24.8.0 r=linter-reviewers,webdriver-reviewers,perftest-reviewers,taskgraph-reviewers,releng-reviewers,dom-storage-reviewers,janv,jmaher,whimboo,afinder,ahal
...
Differential Revision: https://phabricator.services.mozilla.com/D223963
2024-11-03 20:28:59 +00:00
Jon Coppeard
dcaa629428
Bug 1786451 - Part 1: Export MozVirtualAlloc as part of the jemalloc API r=glandium
...
This will allow this function to be used by the JS engine too.
Differential Revision: https://phabricator.services.mozilla.com/D226462
2024-10-31 09:52:34 +00:00
serge-sans-paille
8a0a0f7524
Bug 1920718 - Annotate all global variable with runtime initialization attributes r=glandium,application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh,geckoview-reviewers,win-reviewers,gstoll,m_kato
...
MOZ_RUNINIT => initialized at runtime
MOZ_CONSTINIT => initialized at compile time
MOZ_GLOBINIT => initialized either at runtime or compile time, depending on template parameter, macro parameter etc
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.
Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-30 11:05:24 +00:00
serge-sans-paille
e54774d573
Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
...
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.
Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Alexandru Marc
191ccbe7fe
Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351
2024-10-25 16:42:33 +03:00
serge-sans-paille
53068cdf31
Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
...
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.
Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc
83543f20f2
Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE
2024-10-24 11:37:49 +03:00
serge-sans-paille
c7a369b29a
Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
...
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.
Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Alexandre Lissy
faa7b1b2a7
Bug 1925181 - Properly set small alloc randomization on Android content processes as well r=jld
...
Differential Revision: https://phabricator.services.mozilla.com/D226135
2024-10-21 06:05:44 +00:00
Alexandre Lissy
b6c10eb16a
Bug 1917844 - Expose ForkServer-specific mozjemalloc reinit r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D220578
2024-10-21 06:05:43 +00:00
Alexandre Lissy
b027c28f3f
Bug 1917844 - Assert correct jemalloc randomization state on Content and non Content processes r=jld,glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D221971
2024-10-21 06:05:43 +00:00
Butkovits Atila
156b2012dc
Backed out 8 changesets (bug 1918596, bug 1917575, bug 1874689, bug 1925181, bug 1917844, bug 1925274, bug 1915152) for causing failures at Sandbox.cpp. CLOSED TREE
...
Backed out changeset ce2138248319 (bug 1874689)
Backed out changeset fbe9fbb6ae72 (bug 1925181)
Backed out changeset c9896c8962cb (bug 1925274)
Backed out changeset 6eddbad5949c (bug 1918596)
Backed out changeset b9bf86fa1c74 (bug 1917844)
Backed out changeset 1d4cd83d1a39 (bug 1917844)
Backed out changeset 264a5140fbcb (bug 1917575)
Backed out changeset 87b8512c67c9 (bug 1915152)
2024-10-19 23:27:56 +03:00
Alexandre Lissy
d5498aec0d
Bug 1925181 - Properly set small alloc randomization on Android content processes as well r=jld
...
Differential Revision: https://phabricator.services.mozilla.com/D226135
2024-10-19 08:55:34 +00:00
Alexandre Lissy
de6bf60546
Bug 1917844 - Expose ForkServer-specific mozjemalloc reinit r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D220578
2024-10-19 08:55:33 +00:00
Alexandre Lissy
257033c076
Bug 1917844 - Assert correct jemalloc randomization state on Content and non Content processes r=jld,glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D221971
2024-10-19 08:55:32 +00:00
Adi
43e200afe1
Backed out 6 changesets (bug 1918596, bug 1915152, bug 1917844, bug 1917575, bug 1874689) for causing valgrind bustages. CLOSED TREE
...
Backed out changeset b7f977ce6ea0 (bug 1874689)
Backed out changeset e9ccbb43f903 (bug 1918596)
Backed out changeset 39bf07957c07 (bug 1917844)
Backed out changeset 61d1c38cc516 (bug 1917844)
Backed out changeset 2a9a2bca99ce (bug 1917575)
Backed out changeset dab1b77688b2 (bug 1915152)
2024-10-17 14:56:41 +03:00
Alexandre Lissy
5e9c091dc4
Bug 1917844 - Expose ForkServer-specific mozjemalloc reinit r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D220578
2024-10-17 06:29:54 +00:00
Alexandre Lissy
a0ab183c01
Bug 1917844 - Assert correct jemalloc randomization state on Content and non Content processes r=jld,glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D221971
2024-10-17 06:29:54 +00:00
Cosmin Sabou
1bc4690f6a
Backed out 6 changesets (bug 1917575, bug 1917844, bug 1874689, bug 1918596, bug 1915152) for causing ContentChild crashes. CLOSED TREE
...
Backed out changeset d6dc6d8085b5 (bug 1874689)
Backed out changeset 8c3916995be2 (bug 1918596)
Backed out changeset f77e369d1e0f (bug 1917844)
Backed out changeset 3bee9479316a (bug 1917844)
Backed out changeset 5c72e4a84a2c (bug 1917575)
Backed out changeset af3350e58b0a (bug 1915152)
2024-10-17 00:51:07 +03:00
Alexandre Lissy
02557ac85e
Bug 1917844 - Expose ForkServer-specific mozjemalloc reinit r=glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D220578
2024-10-16 20:10:55 +00:00
Alexandre Lissy
d14345b00e
Bug 1917844 - Assert correct jemalloc randomization state on Content and non Content processes r=jld,glandium
...
Differential Revision: https://phabricator.services.mozilla.com/D221971
2024-10-16 20:10:55 +00:00
Tamas Szentpeteri
8be45dd280
Backed out changeset 4b1409597101 (bug 1920718) for causing bp bustages on rapl.cpp.
2024-10-08 23:27:18 +03:00
serge-sans-paille
069a97307f
Bug 1920718 - Annotate all global variable with runtime initialization as MOZ_RUNINIT r=application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh
...
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.
Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-08 16:49:51 +00:00
Nicolas Silva
90db643e31
Bug 1915144 - Add an API to purge excess dirty pages. r=pbone
...
The intent is to use this after having temporarily increased the max dirty page threshold.
This API will be used off the main thread.
Differential Revision: https://phabricator.services.mozilla.com/D220256
2024-09-19 11:08:47 +00:00