Need a solution :)

Pratyush pratyush.kshirsagar at gmail.com
Wed Sep 29 08:55:56 PDT 2010


Hi! 

Below is what Matt asked me to do: 
To reduce the expense you could aggregate the pv_list_count values together and
store a grand total for each vm_object.  Then the RSS calculation could divide
the grand total for each vm_object by the number of resident vm_pages for that
object to get a rough proportion.


But after Aggelos asked me to do the division reverse, I got confused. So, I am
writing below the solution what I think of would be feasible.

If their is a Process P' and assuming it has only a single
object O'. Suppose, O' has 1000 pages in memory i.e. the resident page count.
Now, if all this 1000 pages each have pv_list_count 3 i.e. each page is shared
by 3 processes (2 processes apart from P'). So the agg_pv_list_count will be
3000 and the resident_page_count is 1000.
Now if I divide agg_*/resident_* it will be 3000/1000 i.e. I get that approx 3
process are sharing that object and should then divide res*/3 to get the
proportional RSS.

Here is the glimpse :

			if(object->resident_page_count != 0) {
				n_pv_entry = (object->agg_pv_list_count / object->resident_page_count);
				if(n_pv_entry != 0) {
					count += (object->resident_page_count / n_pv_entry);
				}
			}

Top output (copy-paste discarding garbage) > 
The command section shows firefox-bin on third line, please check the output of
PRES which is weird. Should I try something different.




load averages:  0.11,  0.09,  0.03;               up 0+00:05:23        10:56:32
30 processes: 1 running, 30 active
CPU states:  0.7% user,  0.0% nice,  0.0% system,  0.0% interrupt, 99.3% idle
Memory: 46M Active, 30M Inact, 143M Wired, 82M Buf, 1781M Free
Swap: 2048M Total, 2048M Free

  PID USERNAME PRI NICE  SIZE    RES    PRES STATE    TIME   CTIME   CPU COMMAND
  750 root     152   0   154M    21M    10M  kqread   0:09    0:09  1.56% Xorg
  798 root     152   0  3948K  1892K  1580K  RUN      0:00    0:00  1.32% top
->785 root     152   0    63M    54M   107M  kqread   0:07    0:07  0.00%
firefox-bin
  761 root     152   0  9108K  5060K  1432K  kqread   0:00    0:00  0.00% fluxbox
  777 root     152   0    12M  7392K  2492K  kqread   0:00    0:00  0.00% urxvt
  760 root     152   0    13M  9128K  5016K  kqread   0:00    0:00  0.00% idesk
  719 root     156   0  3024K  1504K   456K  wait     0:00    0:00  0.00% login
  727 root     153   0  3888K  1556K   764K  pause    0:00    0:00  0.00% csh
  792 root     152   0  6828K  3300K  1084K  kqread   0:00    0:00  0.00% gconfd-2
  775 root     155   0  3104K  1284K   492K  pause    0:00    0:00  0.00% csh
  778 root     152   0  3696K  1652K   700K  pause    0:00    0:00  0.00% csh
  345 root     152   0  1952K  1016K   220K  kqread   0:00    0:00  0.00% syslogd









Have a good Day ...
-Pratyush
<pratyush.kshirsagar [at] gmail.com>







More information about the Kernel mailing list