Commit Graph

1709 Commits

Author SHA1 Message Date
Paul Bone
c37988e025 Bug 1888326 - Advance the chunk index after committing pages r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D205971
2024-04-04 00:03:27 +00:00
Mike Hommey
8b7fc2dba5 Bug 1884054 - Stop wrapping HeapAlloc-family of functions. r=pbone
The functions were wrapped in bug 1280578 mainly for rust, which used
these functions for its global allocator. However, that use case went
away with bug 1514122, where we've set up our own global allocator for
rust that calls the malloc-family of functions directly instead.

Back in that bug, we left the HeapAlloc wrapping for other use cases,
but there are few of them left, but we're now hitting another problem,
where we actually do want to be able to HeapFree pointers that might
have been allocated by system libraries, and the wrapping is getting
on the way of this actually working.

Differential Revision: https://phabricator.services.mozilla.com/D205788
2024-03-28 04:02:03 +00:00
Paul Bone
2edc0f7892 Bug 1885466 - Rename jemalloc_stats::page_cache to pages_dirty r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D204724
2024-03-28 02:41:09 +00:00
Paul Bone
d1cccd9945 Bug 1857841 - pt 10. Tighten an assertion r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D203573
2024-03-19 01:42:44 +00:00
Paul Bone
a0f64f2204 Bug 1857841 - pt 8. Use CHUNK_MAP_FRESH for double-purged pages r=glandium
Using CHUNK_MAP_FRESH for double purged pages is better than overloading
the CHUNK_MAP_DECOMMITTED bit with two different semantics.  It also allows
us to simplify some code.

Differential Revision: https://phabricator.services.mozilla.com/D203571
2024-03-19 01:42:44 +00:00
Paul Bone
02fb924e9b Bug 1857841 - pt 9. Count fresh and madvised memory separately r=glandium
This memory was previously measured as part of committed memory.  However
depending on the OS it will often not be committed.  It's more accurate to
count it separately as part of mozjemalloc's cache of unused pages.

This patch adds counters for both fresh and madvised memory and no-longer
counts either as "committed" as it previously did.

This has the side effect of changing decisions based on the size of this
cache such as when to purge memory.

Differential Revision: https://phabricator.services.mozilla.com/D200415
2024-03-19 01:42:43 +00:00
Paul Bone
709bdf9e73 Bug 1857841 - pt 7. Also amortise VirtualAlloc in SplitRun() r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D195515
2024-03-19 01:42:43 +00:00
Paul Bone
2e587031ab Bug 1857841 - pt 6. Commit more pages than necessary to amortise costs r=glandium
This breaks the old invariant that there are no committed pages that aren't
either allocated or dirty.  There is now also new code in DeallocChunk that
counts the number of "fresh" committed pages and adjusts mStats.committed.

Differential Revision: https://phabricator.services.mozilla.com/D195514
2024-03-19 01:42:42 +00:00
Paul Bone
bc4ccb1adf Bug 1857841 - pt 5. Simplify decommit logic in SplitRun() r=glandium
The decommit logic is now only used when MALLOC_DECOMMIT is defined.  The other
page bits ( CHUNK_MAP_MADVISED and CHUNK_MAP_FRESH) are cleared when the page
is initialised.  This avoids leaving the chunk map in an inconsistent state if
pages_commit should fail.

These changes will make some following patches simpler.

Differential Revision: https://phabricator.services.mozilla.com/D200414
2024-03-19 01:42:42 +00:00
Paul Bone
2568695793 Bug 1857841 - pt 4. Don't decommit then recommit pages in InitChunk r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D195513
2024-03-19 01:42:41 +00:00
Paul Bone
71f4a9c395 Bug 1857841 - pt 3. Add a new page kind named "fresh" r=glandium
Also re-write the descriptions of the page kinds.

Differential Revision: https://phabricator.services.mozilla.com/D203570
2024-03-19 01:42:41 +00:00
Paul Bone
4ca2947b0f Bug 1857841 - pt 2. Remove obsolete comment r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D200413
2024-03-19 01:42:41 +00:00
Paul Bone
4189799792 Bug 1857841 - pt 1. Modernise variable declarations in SplitRun r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D195511
2024-03-19 01:42:40 +00:00
Paul Bone
6f61852dcb Bug 1884996 - Avoid reenterant malloc in PHC's RNG r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D204575
2024-03-15 00:53:17 +00:00
Paul Bone
3a813ca67c Bug 1867190 - Add prefs for PHC probablities r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D198652
2024-01-30 05:33:38 +00:00
Paul Bone
9f2470a841 Bug 1867190 - Make the PHC probability dynamic r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D194364
2024-01-30 05:33:38 +00:00
Paul Bone
48de47067e Bug 1867190 - Initialise the PHC allocate delay later r=glandium
Move this initialisation until when the PHCManager calls SetPHCState().
This is necessary so that the the PHCManager can set the first allocation
delay.

Differential Revision: https://phabricator.services.mozilla.com/D198651
2024-01-30 05:33:38 +00:00
Narcis Beleuzu
1e726a0e49 Backed out 3 changesets (bug 1867190) for bustages on PHC.cpp . CLOSED TREE
Backed out changeset ce5606473bf9 (bug 1867190)
Backed out changeset 3766cf32a308 (bug 1867190)
Backed out changeset 16ce5caa9557 (bug 1867190)
2024-01-25 07:58:11 +02:00
Paul Bone
c665d103ee Bug 1867190 - Add prefs for PHC probablities r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D198652
2024-01-25 05:03:08 +00:00
Paul Bone
72037651f6 Bug 1867190 - Make the PHC probability dynamic r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D194364
2024-01-25 05:03:08 +00:00
Paul Bone
8446cd012f Bug 1867190 - Initialise the PHC allocate delay later r=glandium
Move this initialisation until when the PHCManager calls SetPHCState().
This is necessary so that the the PHCManager can set the first allocation
delay.

Differential Revision: https://phabricator.services.mozilla.com/D198651
2024-01-25 05:03:07 +00:00
Paul Bone
4f15ab146d Bug 1864828 - pt 1. Move operators to create literals with units into mfbt/ r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D194950
2023-12-11 11:01:33 +00:00
Mike Hommey
619672a8e4 Bug 1867459 - Replace CPU_ARCH with TARGET_CPU. r=firefox-build-system-reviewers,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D195157
2023-12-08 10:43:59 +00:00
Logan Rosen
141305b4e4 Bug 1677775 - reformat .mozbuild files with Black r=linter-reviewers,geckoview-reviewers,firefox-build-system-reviewers,ahal,glandium,owlish,sylvestre
#ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D193007
2023-12-08 04:26:45 +00:00
Sylvestre Ledru
d74f9b5552 Bug 1868046 - Remove some nbsp in the code r=linter-reviewers,ahal
Depends on D195369

Differential Revision: https://phabricator.services.mozilla.com/D195370
2023-12-04 15:25:04 +00:00
Iulian Moraru
d6a3f6a6bd Backed out 2 changesets (bug 1864828) for causing build bustages on TestJemalloc.cpp. CLOSED TREE
Backed out changeset c1b4a8307702 (bug 1864828)
Backed out changeset ba88f119b1fc (bug 1864828)
2023-11-30 07:19:04 +02:00
Paul Bone
e1f95a2d2b Bug 1864828 - pt 1. Move operators to create literals with units into mfbt/ r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D194950
2023-11-30 01:17:55 +00:00
Akylzhan
9021fd1e02 Bug 1862508 - FdPrintf.cpp: removed extra ; after member function definition. r=sylvestre DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D194704
2023-11-26 11:43:32 +00:00
Joel Maher
9d203b1d46 Bug 1859893 - batch 15 - migrate xpcshell.ini -> .toml. r=aryx,geckoview-reviewers,extension-reviewers,valentin,cookie-reviewers,pbz,owlish,robwu
Differential Revision: https://phabricator.services.mozilla.com/D194384
2023-11-24 14:41:35 +00:00
Randell Jesup
c0e9f8d3a3 Bug 1865120: clean up chunk_type use in mozjemalloc to reduce false positives r=pbone
Differential Revision: https://phabricator.services.mozilla.com/D193811
2023-11-23 23:51:01 +00:00
Paul Bone
439371cbc2 Bug 1866025 - Check if PHC is initialised on all entrypoints r=glandium
PHC initialisation can bail out on systems without an expected statically
assumed page size.  When this happens Firefox can crash if we don't check
for it on all PHC entrypoints including SetPHCStatus().

Thanks Janne Grunau for the initial patch.

Differential Revision: https://phabricator.services.mozilla.com/D194458
2023-11-23 04:53:22 +00:00
Paul Bone
99d873c7c2 Bug 1862540 - Remove code dealing with non-zeroed chunks r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D192521
2023-11-14 09:44:11 +00:00
Paul Bone
aaa25c6593 Bug 1862378 - Chunk guard pages are not committed memory r=glandium
Don't include the chunk guard pages in our committed memory calculation.

Differential Revision: https://phabricator.services.mozilla.com/D192450
2023-11-14 05:38:25 +00:00
Paul Bone
cec1261b74 Bug 1862378 - Add assertion for waste calculation r=glandium
The waste memory calcuation has an invariant that we can also assert.

Differential Revision: https://phabricator.services.mozilla.com/D192449
2023-11-14 05:38:25 +00:00
Paul Bone
d7d80b6143 Bug 1862378 - Simplify some ifdef conditions r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D192447
2023-11-14 05:38:24 +00:00
Paul Bone
62f879e4b6 Bug 1829127 - Add telemetry for PHC utilisation r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D192303
2023-11-06 04:59:33 +00:00
Paul Bone
f590b3e285 Bug 1857107 - Update the PHC gtest for apple silicon's page size r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D191603
2023-10-26 05:41:15 +00:00
Paul Bone
aa189da432 Bug 1859954 - Use XP_DARWIN rather than XP_MACOS in PHC r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D191600
2023-10-25 05:43:36 +00:00
Paul Bone
f05583b06f Bug 1860464 - Use using rather than typedef r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D191596
2023-10-24 03:54:42 +00:00
Paul Bone
463cfa9630 Bug 1854135 - Set PHC's size to limit it to 1.1MiB per process in release r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D188822
2023-10-24 01:50:52 +00:00
Paul Bone
cbd484acb9 Bug 1859964 - --enable-phc doesn't always imply --enable-frame-pointers r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D191404
2023-10-24 00:52:34 +00:00
Paul Bone
055dc73fbb Bug 1854550 - pt 12. Allow inlining between mozjemalloc and PHC r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D191201
2023-10-19 06:38:43 +00:00
Paul Bone
15b2b96152 Bug 1854550 - pt 10. Allow LOG() with zero extra arguments r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D191134
2023-10-19 06:38:42 +00:00
Paul Bone
d9dfdcc493 Bug 1854550 - pt 9. Move PHC interface from the bridge to PHC.h r=glandium
Building PHC in a unified build now also works.

Differential Revision: https://phabricator.services.mozilla.com/D191133
2023-10-19 06:38:42 +00:00
Paul Bone
d2bdb850c2 Bug 1854550 - pt 8. Rename a variable r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D190423
2023-10-19 06:38:42 +00:00
Paul Bone
69cb1c1b92 Bug 1854550 - pt 7. Call PHC directly rather than through replace malloc r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D190422
2023-10-19 06:38:41 +00:00
Paul Bone
10b0e0fcd7 Bug 1854550 - pt 6. Move AlignedAllocator into a header r=glandium
Move the AlignedAllocator class template into mozjemalloc.h where it can be
used by PHC also.

***
Fix

Differential Revision: https://phabricator.services.mozilla.com/D190417
2023-10-19 06:38:41 +00:00
Paul Bone
870b8d6db1 Bug 1854550 - pt 5. Remove templating around allocation classes r=glandium
This will simplify references/linking between mozjemalloc and PHC.  Plus
this code is clearer (more explicit) without it even though there's more
repitition.

Differential Revision: https://phabricator.services.mozilla.com/D190014
2023-10-19 06:38:40 +00:00
Paul Bone
e4a9b57aa0 Bug 1854550 - pt 4. PHC doesn't use the malloc table to call jemalloc r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D189241
2023-10-19 06:38:40 +00:00
Paul Bone
b9ef763b57 Bug 1854550 - pt 3. Define kAlloc{Junk,Poison} once for jemalloc and PHC r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D190013
2023-10-19 06:38:39 +00:00