Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

User pages accounting

354 bytes added, 09:27, 15 December 2011
m
Reverted edits by TermPaperServices (talk) to last revision by Kir
== Ways of accounting ==
There are tree different approaches to user pages accounting.control:
; Account all the mappings on mmap/brk and reject as soon as the sum of VMA's lengths reaches the barrier.
: This approach is very bad as applications ''always'' map more than they really use, very often MUCH more.
; Account only the really used memory and reject as soon as {{H:title|Resident Set Size|RSS}} reaches the limit.
: This approach is not good either as the only place where pages appear in user space is page fault handler and the only way to reject is killing the task. Comparing to previous scenarion this is much worse as application won't even be able to close correctlyterminate gracefully.
; Account a part of memory on mmap/brk and reject there, and account the rest of the memory in page fault handlers without any rejects.
: This type of accounting is used in UBC.
; Account physical memory and behave like a standalone kernel - reclaim user memory when run out of it.
: This type of memory control is to be introduced later as an addition to current scheme. UBC provides all the needed statistics for this (physical memory, swap pages etc.)
== UBC user pages accounting ==
=== Terms ===
The following terms are used by UBC:
* ''shmem mapping'' — a mapping of file belonging to <code>tmpfs</code>. UBC accounts these pages separately and the description below doesn't take such pages into account;
* ''private mapping'' — this includes the following types of mappings:
* <math>RSS</math> is the amount of physical memory used by processes.
Page fraction — <math>Frac(page, UB)</math> — normally should be <math>\frac{1}{N}</math>, where <math>N</math> is the number of UBs the pages are shared between, but this is bad since adding a new UB to page shared set would require recalculation of the whole current set. In UB <math>Frac(page, UB) = \frac{1}{2^{UB_{shift}}}</math>, where <math>UB_{shift}</math> is some parameter which [[RSS fractions accounting|is calculated ]] so that
<center>
<math>\sum _{UB : page \in UB} Frac(page, UB) = 1, \forall page</math>.
</center>
If you sum the [[privvmpages]] of all beancounters in the system you'll get an upper estimation of current physical memory usage by processes.:
<center>
<math>
\sum _{UB} UB_{privvm} = \,
</math>
<math>
RSS + \sum _{UB} UB_{unused}\,
</math>
</center>
<center>
<math>
\sum _{UB} UB_{physpages} = RSS\,
</math>
</center>
----
<references/>
 
[[Category: Kernel internals]]