On Wed Jun 28 16:39:03 2023 +0000, Jinoh Kang wrote:
1. [user-handles] is tracking per-*session* state (`gSharedInfo`). It appears to me that a *process* is associated with at most one session at any time. Also, each *process* has only one mapping backed by the session shared memory. 2. This MR is tracking per-*desktop* state (`desktop_shm_t`). It appears to me that a *thread* is associated with at most one desktop at any time. Also, each *thread* has only one mapping backed by the desktop shared memory. - Transitively, a process can have multiple mappings backed by some desktop shared memory, since a process can have multiple threads. - If two or more threads have the same desktop, then each of those threads will have a *different* mapping backed by the *same* desktop shared memory. I believe *this* part is what is believed to be wasteful. [user-handles]: https://gitlab.winehq.org/jacek/wine/-/tree/user-handles Instead of letting each thread own a unique desktop-state mapping, perhaps we should instead make the virtual memory mapping ref-counted, and maintain a mapping from a desktop's unique ID to the refcounted mapping (which is backed by the same section).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3103#note_37159