Approach to the RSS
--000e0cd32f96f6403204896d4a61
Content-Type: text/plain; charset=ISO-8859-1
Hello,
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.
Thanks,
Pratyush Kshirsagar.
--000e0cd32f96f6403204896d4a61
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hello,<div>I came up with the following approach.=A0</div><div>I went throu=
gh the code and the book named "Implementation of free BSD system"=
; for some detail understanding.</div><div><br></div><div>There is a vmspac=
e structure=A0embedding=A0vm_map structure. The vm_map structure in turn po=
ints to the head of vm_map_entry.</div>
<div>The vm_map_entry points to the vm_object.</div><div>The structure vm_o=
bject contains the reference count of the number of vm_map_entry or other o=
bjects referencing it.</div><div>Also, the vm_object structure has count of=
the number of resident pages.</div>
<div><br></div><div>struct vm_object {</div><div>....</div><div>int ref_cou=
nt;</div><div>....</div><div>int resident_page_count;</div><div>....</div><=
div>};</div><div><br></div><div>Suppose their are 2 process, proc_A and pro=
c_B.=A0proc_A has three references to a object and proc_B has 2.</div>
<div>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 proporti=
onal RSS for proc_A and multiplying by 2 will give it for proc_B.</div>
<div>Thus, we can get it without going very deep into the convoluted chain.=
And which will be fast.</div><div><br></div><div><br></div><div>If you guy=
s think its a feasible solution, I can carry it and test it. After the test=
ing if the results are weird we can just move forward till the depth of the=
chain.</div>
<div><br></div><div>Thanks,</div><div>Pratyush Kshirsagar.</div>
--000e0cd32f96f6403204896d4a61--
討論串 (同標題文章)