Editing VSwap
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
'''New [[Download/kernel/rhel6|RHEL6-based OpenVZ]] kernel''' has a new memory management model, which supersedes [[UBC|User beancounters]]. It is called '''VSwap'''. | '''New [[Download/kernel/rhel6|RHEL6-based OpenVZ]] kernel''' has a new memory management model, which supersedes [[UBC|User beancounters]]. It is called '''VSwap'''. | ||
− | + | Now you can set two primary parameters: <code>physpages</code> and <code>swappages</code>, while all the other beancounters become secondary and optional. | |
− | |||
− | |||
* '''physpages''' | * '''physpages''' | ||
− | : This parameter | + | : This parameter limits the physical memory (RAM) available to processes inside a container. |
− | |||
: The <code>barrier</code> is ignored and should be set to 0, and the <code>limit</code> sets the limit. | : The <code>barrier</code> is ignored and should be set to 0, and the <code>limit</code> sets the limit. | ||
− | + | : Currently (as of >= 042stab042) the user memory, the kernel memory and the page cache are accounted into <code>physpages</code>. | |
− | |||
− | : | ||
* '''swappages''' | * '''swappages''' | ||
− | : This parameter | + | : This parameter limits the amount of swap space which can be used for processes inside a container. |
− | |||
: The <code>barrier</code> is ignored and should be set to 0, and the <code>limit</code> sets the limit. | : The <code>barrier</code> is ignored and should be set to 0, and the <code>limit</code> sets the limit. | ||
− | |||
− | |||
− | |||
The sum of <code>physpages.limit</code> and <code>swappages.limit</code> limits the maximum amount | The sum of <code>physpages.limit</code> and <code>swappages.limit</code> limits the maximum amount | ||
− | of memory which can be used by a container. When physpages limit | + | of allocated memory which can be used by a container. When physpages limit |
is reached, memory pages belonging to the container are pushed out to | is reached, memory pages belonging to the container are pushed out to | ||
so called virtual swap (''vswap''). The difference between normal swap | so called virtual swap (''vswap''). The difference between normal swap | ||
Line 29: | Line 20: | ||
swapping. Actual swap out occurs only if there is a global memory shortage | swapping. Actual swap out occurs only if there is a global memory shortage | ||
on the system. | on the system. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Setting == | == Setting == | ||
Line 68: | Line 29: | ||
vzctl set 777 --ram 512M --swap 1G --save | vzctl set 777 --ram 512M --swap 1G --save | ||
− | == Convert non- | + | If you are converting an existing CT from old (non-vswap) configuration, you can either |
+ | * leave all the other UBC parameters as-is, | ||
+ | * or set those to 'unlimited', | ||
+ | * or remove those from configuration file. | ||
+ | |||
+ | == Convert non-vswap CT to Vswap == | ||
If you have an existing container with usual UBC parameters set, and you want to convert this one into VSwap enabled config, here's what you need to do. | If you have an existing container with usual UBC parameters set, and you want to convert this one into VSwap enabled config, here's what you need to do. | ||
Line 76: | Line 42: | ||
# Add PHYSPAGES and SWAPPAGES parameters to config. Easiest way is to use <code>vzctl set $CTID --ram N --swap M --save</code> | # Add PHYSPAGES and SWAPPAGES parameters to config. Easiest way is to use <code>vzctl set $CTID --ram N --swap M --save</code> | ||
− | Now your config is vswap enabled, and when you (re)start it | + | Now your config is vswap enabled, and when you (re)start it, vswap mechanism will be used by the kernel for this CT. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== See also == | == See also == | ||
− | + | * [http://openvz.livejournal.com/39765.html Recent improvements in VSwap] | |
− | * [http://openvz.livejournal.com/39765.html Recent improvements in | ||
[[Category: UBC]] | [[Category: UBC]] |