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 use this program to determine the page size for your architecture:
#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):
# gcc pagesize.c -o pagesize # ./pagesize The reported page size was 4096
The following snippet from the getpagesize man page has some interesting information:
"Whether getpagesize() is present as a Linux system call depends on the architecture. If it is, it returns the kernel symbol PAGE_SIZE, which is architecture and machine model dependent. Generally, one uses binaries that are architecture but not machine model dependent, in order to have a single binary distribution per architecture. This means that a user program should not find PAGE_SIZE at compile time from a header file, but use an actual system call, at least for those architectures (like sun4) where this dependency exists. Here libc4, libc5, glibc 2.0 fail because their getpagesize() returns a statically derived value, and does not use a system call. Things are OK in glibc 2.1."