Files
tubestation/memory
Jens Stutte ad5ec08465 Bug 1920451 - Introduce a concept of last significant re-use to decide when to purge. r=pbone,smaug
We want to better predict when it is a good moment to purge. D220616 answered well the question, when to best process a purge when it is needed (that is, during main thread idle time), but that does not necessarily mean it is a good idea for a single arena, to purge in that moment as arenas can be used on other threads intensely while the main thread is idle.

If we saw a recent re-use in an arena we can most likely expect to come more of that and wait with purge a little more. So whenever we are able to re-use a dirty page, we assume that this is a sign of a significant re-use that avoided an allocation of new memory.

We can record a timestamp of when this happened. Unless forced, purge requests are only executed, if their grace period wrt the last significant re-use expired.

Finally we introduce the third result `WantsLater` for a single purge step, which indicates that there are purge requests that wait for their grace period to expire and the main thread should do some later extra spin to process those.

***
Default Atomic

Differential Revision: https://phabricator.services.mozilla.com/D223709
2025-02-19 07:21:15 +00:00
..