lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <008301c6af35$14f9f1d0$0100a8c0@serty1>
Date:	Mon, 24 Jul 2006 16:23:14 +0100
From:	"Damien Pacaud" <05087635@...okes.ac.uk>
To:	<linux-kernel@...r.kernel.org>
Subject: Odd values in /proc

Hi all,
I was recently fooling with /proc for a school project and found out
that ps and top are not doing the same calculation about memory load.

For instance :


ps aux | grep X
3323  1.5  5.9  64948 53996


ok, so the value for the VSS size read by ps is : 64948 and the value
for the RSS size is 53996


Let's look at top now :

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND


 3323 root      15   0  191m  52m 7284 S 11.9  6.0  39:05.93 X


Ok, so for Top , the Virtual mem size is 191m.
This is somewhat different to the 64948Kb found by Ps.


Am I wrong by thinking that these two values should be the same ?


I've done the same test with other programs and most of the times, the
values are the same.
I really don't understand it ;)

I digged a bit deeper to see where the difference comes from.


There are at least two different files in /proc that gives you the mem
load of a particular process.


Those files are : /proc/[PID]/statm and /proc/[PID]/status


let's look at those files for this example


serty2@...ty2 ~ $ more /proc/3323/status
Name:   X
State:  S (sleeping)
SleepAVG:       98%
Tgid:   3323
Pid:    3323
PPid:   3320
TracerPid:      0
Uid:    0       0       0       0
Gid:    0       0       0       0
FDSize: 256
Groups:
VmSize:    65080 kB
VmLck:         0 kB
VmRSS:     54128 kB
VmData:    46772 kB
VmStk:        84 kB
VmExe:      1532 kB
VmLib:     13124 kB
VmPTE:       224 kB
Threads:        1
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001000
SigCgt: 00000001d1806ecb
CapInh: 00000000fffffeff
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff


Ok , so the VmSize is 65080 , that really looks like the value we got
from ps ;)
(not the exact same because of the time delay between the two tests)


Let's look at the other file :


serty2@...ty2 ~ $ more /proc/3323/statm
49166 13532 1821 383 0 11714 0


as stated in proc's man , the first value is the  total program size in
mem pages.


then : (49166 * 4096) / (1024²) =192Mb


We're pretty close to the value given by Top .


I don't understand why there is a difference for those values for some
programs.
And most important of it, I really don't know what value to use ;)


I think I would go for the value in /proc/[PID]/statm because the
/proc/[PID]/status is supposed to be only a aggregate of information
found in other files and made "human-readable".
But then, I'm not sure.


Does anyone know which file holds the right value ?


Thanks for any comments


Damien


PS : please excuse my english mistakes ;)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ