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

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 06 Dec 2023 23:36:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275436

--- Comment #8 from Konstantin Belousov <kib@FreeBSD.org> ---
(In reply to Mike Karels from comment #7)
Being able to free one page is not equal to ability to free needed number of
pages, this is why 'global' OOM works only in specific situations.

Proposals to limit max tmpfs page uses to some percentage of the total of
memory and swap would not work.  Problem is that some memory is 'managed',
some is not.  For instance, all file-backed pages should be considered as
free for the purpose of the limits calculation, otherwise an app mapping
a large file and reading it would cause un-explanable ENOSPC failures from
tmpfs.  And in reverse, allowing say 80% of total use by tmpfs does not prevent
a situation where we do fill that limit, and then kernel needs a lot of
unmanaged
memory, for instance, for sockets buffers due to bursts of a network activity.

There is simply no reasonable answer to question 'how to limit tmpfs physical
memory consumption' without knowing the system load pattern.  And if you know
the load and care about memory limiting, there is already the size option.

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