freebsd-skq/sys/fs/tmpfs
Konstantin Belousov 3364c323e6 Implement global and per-uid accounting of the anonymous memory. Add
rlimit RLIMIT_SWAP that limits the amount of swap that may be reserved
for the uid.

The accounting information (charge) is associated with either map entry,
or vm object backing the entry, assuming the object is the first one
in the shadow chain and entry does not require COW. Charge is moved
from entry to object on allocation of the object, e.g. during the mmap,
assuming the object is allocated, or on the first page fault on the
entry. It moves back to the entry on forks due to COW setup.

The per-entry granularity of accounting makes the charge process fair
for processes that change uid during lifetime, and decrements charge
for proper uid when region is unmapped.

The interface of vm_pager_allocate(9) is extended by adding struct ucred *,
that is used to charge appropriate uid when allocation if performed by
kernel, e.g. md(4).

Several syscalls, among them is fork(2), may now return ENOMEM when
global or per-uid limits are enforced.

In collaboration with:	pho
Reviewed by:	alc
Approved by:	re (kensmith)
2009-06-23 20:45:22 +00:00
..
tmpfs_fifoops.c Reflect license change of NetBSD code. 2008-09-03 18:53:48 +00:00
tmpfs_fifoops.h Reflect license change of NetBSD code. 2008-09-03 18:53:48 +00:00
tmpfs_subr.c Implement global and per-uid accounting of the anonymous memory. Add 2009-06-23 20:45:22 +00:00
tmpfs_vfsops.c Remove the thread argument from the FSD (File-System Dependent) parts of 2009-05-11 15:33:26 +00:00
tmpfs_vnops.c Eliminate unnecessary variables. 2009-06-13 20:21:08 +00:00
tmpfs_vnops.h Reflect license change of NetBSD code. 2008-09-03 18:53:48 +00:00
tmpfs.h Remove the thread argument from the FSD (File-System Dependent) parts of 2009-05-11 15:33:26 +00:00