On 2022-06-11 10:06, Christian König wrote:
Am 10.06.22 um 16:16 schrieb Michal Hocko:FWIW, in the steady state, the game will cycle between a small (generally 2-5) set of buffers. The game will not cause new buffers to be exported & imported for every frame.
[...]That's what I had in mind as well. Problem with this approach is that file descriptors are currently not informed that they are shared between processes.
The memory is accounted to whoever faults that memory in or to theJust consider the above mentioned memcg driven model. It doesn't reallyOk, how does that work then?
require to chase specific files and do some arbitrary math to share the
responsibility. It has a clear accounting and responsibility model.
allocating context if that is a kernel memory (in most situations).
So to make this work we would need something like attach/detach to process in struct file_operations.
And as I noted, this happens rather often. For example a game which renders 120 frames per second needs to transfer 120 buffers per second between client and X.
In general, I'd expect dma-buf export & import to happen relatively rarely, e.g. when a window is opened or resized.