DragonFly BSD
DragonFly kernel List (threaded) for 2010-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Approach to the RSS

From: Pratyush Kshirsagar <pratyush.kshirsagar@xxxxxxxxx>
Date: Sat, 19 Jun 2010 22:53:28 -0400

I came up with the following approach. 
I went through the code and the book named "Implementation of free BSD system" for some detail understanding.

There is a vmspace structure embedding vm_map structure. The vm_map structure in turn points to the head of vm_map_entry.
The vm_map_entry points to the vm_object.
The structure vm_object contains the reference count of the number of vm_map_entry or other objects referencing it.
Also, the vm_object structure has count of the number of resident pages.

struct vm_object {
int ref_count;
int resident_page_count;

Suppose their are 2 process, proc_A and proc_B. proc_A has three references to a object and proc_B has 2.
Thus, now their are five references and if we divide the resident_page_count by ref_count, we can then multiply it by 3 to get/calculate proportional RSS for proc_A and multiplying by 2 will give it for proc_B.
Thus, we can get it without going very deep into the convoluted chain. And which will be fast.

If you guys think its a feasible solution, I can carry it and test it. After the testing if the results are weird we can just move forward till the depth of the chain.

Pratyush Kshirsagar.

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]