Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

RSS fractions accounting

62 bytes added, 12:54, 24 January 2008
m
kernel internals
In a C-like notation this would look like this:
<presource lang="C">
pb = lookup_pb(page, UB);
if (pb != NULL) {
list_add_tail(pb, page.pb_list);
page.pb_list.first = head.next;
</presource>
Shift increment essentially means “take one half of the currently held fraction and give it to the newbie”.
; The last reference is removed
: In this case the PB that ties page and UB must give its shift back to other PBs and be removed from list. This “giving shift back” procedure may involve three PBs and it is better described by the code example below.
<presource lang="C">
pb = lookup_pb(page, UB);
pb.refcount--;
page.pb_list.first = tail
}
</presource>
Decrementing the shifts like this means “take the fraction held by the PB going out and give it to another one; if the fraction held is too large — share it between two PBs”.
{{Note|cases when <code>page.pb_list</code> is becoming empty on adding a reference, or becoming empty on removing references are skipped to simplify the code examples.}}
 
[[Category: Kernel internals]]