[Bug 275436] tmpfs does not honor memory limits on writes

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 03 Dec 2023 08:04:51 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275436

--- Comment #6 from Konstantin Belousov <kib@FreeBSD.org> ---
VM (alomst) always ensures that there are several free pages.  More, it even
typically manages to free several pages in reasonable time.

This is why our OOM organized in current way:
- global OOM triggers when VM cannot get a free page despite existence of the
  page shortage, in all domains, for some time.  It is typically triggered
  when kernel allocates too much unmanaged pages (not tmpfs case).
- per-process OOM triggers when page fault handler needs a page and cannot
  allocate it after several cycles of allocation attempts.

I added the second (per-process) OOM since global OOM (similar to your patch)
was not able to handle typical situation with usermode sitting on too many
dirty pages.

Now that I formulated this, I think that for tmpfs a reasonable approach would
be something in line of per-process OOM: try the allocation, and return ENOSPC
if it failed, with some criteria for restart.  You might look at vm/vm_fault.c
vm_fault_allocate_oom().

-- 
You are receiving this mail because:
You are the assignee for the bug.