Editing User pages accounting
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 8: | Line 8: | ||
== Ways of accounting == | == Ways of accounting == | ||
− | There are | + | There are tree approaches to user pages accounting. |
; Account all the mappings on mmap/brk and reject as soon as the sum of VMA's lengths reaches the barrier. | ; 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. | : 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. | ; 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 | + | : 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 correctly. |
; 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. | ; 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. | : This type of accounting is used in UBC. | ||
− | |||
− | |||
== UBC user pages accounting == | == UBC user pages accounting == | ||
=== Terms === | === Terms === | ||
− | The following terms are used by UBC | + | 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; | * ''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: | * ''private mapping'' — this includes the following types of mappings: | ||
Line 37: | Line 35: | ||
* <math>RSS</math> is the amount of physical memory used by processes. | * <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 | + | 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 is calculated so that |
<center> | <center> | ||
<math>\sum _{UB : page \in UB} Frac(page, UB) = 1, \forall page</math>. | <math>\sum _{UB : page \in UB} Frac(page, UB) = 1, \forall page</math>. | ||
Line 51: | Line 49: | ||
</center> | </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 | + | 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> | <center> | ||
<math> | <math> | ||
− | \sum _{UB} UB_{privvm} = | + | \sum _{UB} UB_{privvm} = |
</math> | </math> | ||
Line 71: | Line 69: | ||
<math> | <math> | ||
− | RSS + \sum _{UB} UB_{unused} | + | RSS + \sum _{UB} UB_{unused} |
</math> | </math> | ||
</center> | </center> | ||
Line 85: | Line 83: | ||
<center> | <center> | ||
<math> | <math> | ||
− | \sum _{UB} UB_{physpages} = RSS | + | \sum _{UB} UB_{physpages} = RSS |
</math> | </math> | ||
</center> | </center> | ||
Line 91: | Line 89: | ||
---- | ---- | ||
<references/> | <references/> | ||
− | |||
− |