On Wed 27-01-21 12:08:50, Christian König wrote:
Am 27.01.21 um 12:02 schrieb Michal Hocko:
On Wed 27-01-21 11:53:55, Christian König wrote: [...]
In general processes are currently not held accountable for memory they reference through their file descriptors. DMA-buf is just one special case.
True
In other words you can currently do something like this
fd = memfd_create("test", 0); while (1) write(fd, buf, 1024);
and the OOM killer will terminate random processes, but never the one holding the memfd reference.
memfd is just shmem under cover, no? And that means that the memory gets accounted to MM_SHMEMPAGES. But you are right that this in its own doesn't help much if the fd is shared and the memory stays behind a killed victim.
I think so, yes. But I just tested this and it doesn't seem to work correctly.
When I run the few lines above the OOM killer starts to terminate processes, but since my small test program uses very very little memory basically everything else gets terminated (including X, desktop, sshd etc..) before it is terminated as well.
Something worth looking into. Maybe those pages are not really accounted properly after all. Can you send a separate email about details with oom reports please?