We currently migrate to MediaWiki from our old installation, but not all content has been migrated yet. Take a look at the Wiki Team page for instructions how to help or browse through our new wiki at wiki.linux-vserver.org to find the information already migrated.
Limit | ProcFS | config | Code | Unit | Description | |
-t | CPU | cpu | U- | s | amount of cpu time in seconds | |
-f | FSIZE | fsize | U- | kb | size of files created by the shell | |
-d | DATA | data | U- | kb | size of a process's data segment | |
-s | STACK | stack | U- | kb | stack size | |
-c | CORE | core | U- | kb | size of core files created | |
-m | RSS | RSS | rss | -R | page | resident set size |
-u | NPROC | PROC | nproc | UR | 1 | number of processes |
-n | NOFILE | FILES | nofile | UR | 1 | number of file handles |
-l | MEMLOCK | VML | memlock | UR | page | pages locked into memory |
-v | AS/VM | VM | as | -R | page | virtual memory pages |
-? | LOCKS | LOCKS | locks | UR | 1 | file system locks |
-? | SIGPENDING | Ur | 1 | pending signals | ||
-p | MSGQUEUE | MSGQ | -r | 512b | message queue size | |
-? | NICE | U- | 1 | minimum nice level | ||
-? | RTPRIO | U- | 1 | maximum realtime prio | ||
VLimit | ||||||
-- | NSOCK (16) | SOCK | -R | 1 | number of sockets | |
-- | OPENFD (17) | OFD | -R | 1 | number of file descriptors | |
-- | ANON (18) | ANON | -r | page | anonymous memory pages | |
-- | SHMEM (19) | SHM | -r | page | shared memory pages |
Code | Description |
U ... | ulimit (supported) |
R ... | rlimit (fully supported) |
r ... | rlimit (accounted/planned) |
- ... | unsupported |
RSS and AS, at least, can be applied across the whole VServer. See Caps And Flags for details.
When calculating limits which use pages such as RSS, AS, you will need to know the size of a page. On x86, the size of a page is 4k. On x86_64, it is usually either 4k or 16k. For information on how to determine the page size, please see the section further below.
For example, if RSS (the real memory) and VM (the virtual address space) should be restricted, the appropriate config files could be the following. Note that you might have to create these directories.
# ls -al /etc/vservers/vs27/rlimits total 28 drwxr-xr-x 2 root root 4096 2005-08-24 12:37 . drwxr-xr-x 5 root root 4096 2005-08-24 00:22 .. -rw-r--r-- 1 root root 6 2005-08-24 12:43 as -rw-r--r-- 1 root root 6 2005-08-24 00:36 memlock -rw-r--r-- 1 root root 5 2005-08-24 12:42 nproc -rw-r--r-- 1 root root 6 2005-08-24 12:37 rss # cat /etc/vservers/vs27/rlimits/rss 10000 # cat /etc/vservers/vs27/rlimits/as 90000
ProcFS shows current values of the limits:
# cat /proc/virtual/27/limit PROC: 6 18 5000 0 VM: 3705 23158 90000 0 VML: 0 0 10000 0 RSS: 1344 7965 10000 0 ANON: 205 205 -1 0 FILES: 87 150 -1 0 OFD: 37 37 -1 0 LOCKS: 2 6 -1 0 SOCK: 3 3 -1 0 MSGQ: 0 0 -1 0 SHM: 0 0 -1 0
Columns are:
So column 5 shows how often the maximum was reached and the kernel had to deny a resource request.
To be continued ...
You can unreliably (?) determine the page size simply by grepping in the kernel sources:
linux $ pwd /usr/src/linux linux $ grep -i EXEC_PAGESIZE include/*/* include/asm-x86_64/elf.h:#define ELF_EXEC_PAGESIZE 4096 (remaining hits not included)
Alternatively, you can use this program to determine the page size:
#include <stdlib.h> #include <stdint.h> #include <unistd.h> int main(int argc, char *argv[]) { int ps = getpagesize(); printf("The reported page size was %d\n", ps); exit(0); }
Here's how to compile and run it (assuming you save it as pagesize.c):
linux $ gcc pagesize.c -o pagesize linux $ ./pagesize The reported page size was 4096