mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
Write a sleeping session's memory to storage instead of zram
This commit is contained in:
1 parent
fe6f8638c6
commit
ad6bb159d3
7 files changed
+823
-26
No files matched your search
@@ -97,6 +97,22 @@ out, and resuming reads it back when available memory is at least twice what tho
|
||||
have in swap at that moment and, after it, 1 GiB or a tenth of RAM, whichever is larger, stays
|
||||
available.
|
||||
|
||||
## Writing a sleeping session to storage
|
||||
|
||||
With the `diskSpill` session pref on, the suspend for sleep writes each preloaded process's
|
||||
private memory to storage instead of zram (request `4`). The preload's worker starts a helper
|
||||
process that shares the process's memory, stops every other thread with ptrace (which also holds
|
||||
threads that block every signal, as Mesa's queue threads do, and which `SIGCONT` does not undo),
|
||||
writes readable private anonymous memory to an unlinked file next to the control file, drops it,
|
||||
and answers the kB it wrote in `/tmp/.dd-zram.ack.<pid>`. Regions registered with userfaultfd,
|
||||
locked or I/O memory and the preload's own memory stay. The app adds one to
|
||||
`/tmp/.dd-zram.resume` before it continues any process; the helper then reads everything back
|
||||
(through `/proc/<pid>/mem` where the pages are not writable), answers `/tmp/.dd-zram.restored.<pid>`
|
||||
and lets the threads go. A process that cannot be traced answers `0` and pages out to zram instead.
|
||||
|
||||
On an AYN Thor with Bully at its menu, 30 processes wrote 1,227 MB in 2.1 seconds and read it
|
||||
back in 1.3 seconds; system anonymous memory fell from 2.53 to 1.21 GB while asleep.
|
||||
|
||||
## Threads
|
||||
|
||||
When a worker can be started, page-out runs outside the game's threads. The preload's signal
|
||||
|
||||
Reference in new issue
Block a user