Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getrlimit(2)

getrusage(2)

mmap(2)

munmap(2)

vmtune(8)

VM_CTL(2)  —  UNIX Programmer’s Manual

NAME

vm_ctl − examine and change virtual memory tuning parameters

SYNOPSIS

#include <sys/types.h>
#include <sys/vmsystm.h>

vm_ctl(operation, argp)
int operation;
union {
struct vm_tune ∗vmtune;
unsigned long ∗procrss;
bool_t onoff;
}argp;

DESCRIPTION

Vm_ctl examines and changes virtual memory (VM) related parameters.  The function performed depends on the value of operation.

If operation is VM_GETPARAM, vm_ctl fetches the system-wide VM tuning parameters into the structure pointed to by vmtune. No special permissions are required to obtain this information.

If operation is VM_SETPARAM, the system-wide VM tuning parameters become the values in the structure pointed to by vmtune. Existing processes are unaffected by some of the per-process tuning parameters; new processes, however, are bound by the new values. This form of the call is permitted only to the super-user.

If operation is VM_GETRS, the unsigned long pointed to by procrss is filled with the allowable resident set size of the calling process.  No special permissions are required to obtain this information. 

If operation is VM_SETRS, the resident set size of the calling process is set to the unsigned long pointed to by procrss. This value must be within the system-wide bounds currently enforced via the VM_SETPARAM operation (described above), and the per-process resident set size restriction (set with setrlimit). This form of the call is permitted only to the super-user.

If operation is VM_SWAPABLE, the calling process is declared non-swappable if “onoff” is zero; otherwise, the calling process is declared swappable.  The swappable attribute is inherited across forks and execs.  This form of the call is permitted only to the super-user, unless the proper configuration parameter has been altered (see “NOTES” later).  Note: VM_SWAPABLE has only one “P”. 

If operation is VM_PFFABLE, the calling process is declared non-PFFable if “onoff” is zero; otherwise, the calling process is declared PFFable.  When a process is PFFable, its resident set size will be altered based on the frequency at which the process page-faults.  The PFFable attribute is inherited across forks and execs.  This form of the call is permitted only to the super-user, unless the proper configuration parameter has been altered (see “NOTES” later). 

RETURN VALUE

If the call succeeds, 0 is returned.  Otherwise, a −1 is returned, and the error code is stored into errno.

The structure pointed to by vmtune is defined in <sys/vmsystm.h> as:

/∗
 ∗ VM System parameters; tunable.
 ∗
 ∗ Where appropriate, the units (HW pages or clusters) are noted.
 ∗ PFF rate units (PFFlow, PFFhigh) may change if faults/sec isn’t
 ∗ enough resolution.  Note that clusters are 4kb on Symmetry systems
 ∗ and 2kb on Balance.
 ∗/
 structvm_tune{
longvt_minRS;/∗ min # clusters for Rset ∗/
longvt_maxRS;/∗ max # clusters for Rset; limited by maxRS ∗/
longvt_RSexecslop;/∗ # HW pages slop in exec ∗/
longvt_RSexecmult;/∗ Rset size multipler ∗/
longvt_RSexecdiv;/∗ Rset size divider ∗/
intvt_dirtylow;/∗ dirty-list low-water mark (HW pages) ∗/
intvt_dirtyhigh;/∗ dirty-list high-water mark (HW pages) ∗/
intvt_klout_look;/∗ pageout kluster look-ahead (clusters) ∗/
longvt_PFFvtime;/∗ ticks between PFF adjusts; 0 ==> no PFF ∗/
longvt_PFFdecr;/∗ # clusters to decrement if PFF < PFFlow ∗/
longvt_PFFlow;/∗ low PFF rate, <= PFFhigh (faults/sec) ∗/
longvt_PFFincr;/∗ # clusters to add if PFF > PFFhigh ∗/
longvt_PFFhigh;/∗ high PFF rate (faults/sec) ∗/
longvt_minfree;/∗ free-list low bound for swap (HW pages) ∗/
longvt_desfree;/∗ free-list high bound for swap (HW pages) ∗/
longvt_maxdirty;/∗ max dirty-list before swap (HW pages) ∗/
};

ERRORS

[EFAULT] The memory pointed to by vmtune or procrss lies outside the valid address space for the process. 

[EINVAL] operation is not one of the supported values. 

[EINVAL] An element of the structure pointed to by vmtune is not within permissible range. 

[EPERM] The process does not have the proper permissions to make the requested change. 

SEE ALSO

getrlimit(2), getrusage(2), mmap(2), munmap(2), vmtune(8)

NOTES

Setting the resident set size (via VM_SETRS) does not actually change the current number of resident pages.  Pages will be added or removed through normal page faulting activity. 

The system verifies that the tuning parameters at least have some degree of sanity to avoid immediate obvious panics.  However, ignorant alterations of tuning parameters will most certainly result in a severe degradation in response. 

Binary configuration of ability for non-root processes to disable swapping, PFF-ing, or adjusting the size of the resident set is provided via three variables in /sys/conf/param.c: root_vm_swapable, root_vm_pffable, root_vm_setrs, respectively. If any of these variables is non-zero, the corresponding function is available only to root processes. Note: root_vm_swapable has only one “p”.

DYNIX

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026