6,534
edits
Changes
m
→Example: use source tag
Currently we account for the [[physpages]] resource, that is, the number of physical pages consumed by a set of processes. The accounting hooks are placed inside the page fault handlers and thus hurting the performance. Currently accounting looks like this:
<presource lang="c">
struct page *get_new_page(struct mm_struct *mm)
{
return NULL;
}
</presource>
However, we have a good upper estimation of the RSS size — that is the lengths of mappings of the processes. Since the physical pages can only be allocated within these mappings, the RSS value can never exceed the sum of their lengths. The accounting will then look like this:
<presource lang="c">
struct vm_area_struct *get_new_mapping(struct mm_struct *mm,
unsigned long pages)
return NULL;
}
</presource>
We do not call the slow <code>charge_beancounter()</code> function in the page fault (<code>get_new_page()</code>). Instead we account for the upper estimation in <code>get_new_mapping()</code> call that happens rarely and thus do not affect the performance.