Bug 173197 - ps display of large values for VSZ
ps display of large values for VSZ
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: procps (Show other bugs)
3
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-14 16:25 EST by Alfred Ganz
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-11-15 09:12:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alfred Ganz 2005-11-14 16:25:00 EST
Description of problem:
Using ps -eo <some>,vsz,<some> doesn't seem to display very large values
properly, in my case it is the X process. Using field 23 of /proc/<pid>/stat
the virtual size shows 298252 KB, which is also what top shows, but ps shows
35140. Note that this doesn't seem to be a formating problem, the same value
shows with ps -eo <some>,vsz:8,<some>, also, I get the same problem using ps aux
(i.e. BSD type output). The largest value that I found displayed properly
in my example happens to be 113036.

Version-Release number of selected component (if applicable):
procps-3.2.3-5.3, from the fedora-core 3 released updates

How reproducible:
always

Steps to Reproduce:
1. do ps aux while running a large process
2.
3.
  
Actual results:
check the VSZ value

Expected results:


Additional info:
Comment 1 Alfred Ganz 2005-11-14 17:30:27 EST
This is more ugly than I thought, here is a ps command for 3 large processes,
and the corresponding outputs from reading the elements from /proc/<pid>/stat files:
xx(3250) ps -o user,pid,%cpu,%mem,vsz:8,rss,tname,stat,start_time,bsdtime,args
-p 30215 -p 23199,16981
USER       PID %CPU %MEM      VSZ  RSS TTY      STAT START   TIME COMMAND
root     30215  0.1  7.3    38112 18252 ?       S    Oct11  71:49 X :0
ganz     16981  0.1 18.5   141500 45816 tty1    Sl   Nov06  12:39 /usr/lib/mozilla
ganz     23199  0.1  8.3   274852 20580 tty1    Sl   17:02   0:01 java_vm 

And here are values from the /proc/<pid>/stat files (KB and B):
 16981 141500 144896000
 23199 274852 281448448
 30215 301224 308453376

This doesn't seem to make sense, I will try if I can create a yet larger process!
Comment 2 Alfred Ganz 2005-11-14 22:29:25 EST
Well, here is some more, when I use VmSize: from /proc/<pid>/status, then I get
this (note that sizes have slightly changed):
# ps -o user,pid,rss:8,vsz:8,start_time:8 -p 30215,23199,16981
USER       PID      RSS      VSZ    START
root     30215    15888    40392    Oct11
ganz     16981    39816   141488    Nov06
ganz     23199    24948   280872    17:02

and:
# cat /proc/23199/status |fgrep VmSize:
VmSize:   280872 kB
# cat /proc/30215/status |fgrep VmSize:
VmSize:    40392 kB
but when I use /proc/<pid>/stat:
# cat /proc/23199/stat | gawk '{ print $23 / 1024 }'
280872
# cat /proc/30215/stat | gawk '{ print $23 / 1024 }'
303504

looks to me like we have a discrepancy between /proc/<pid>/stat and
/proc/<pid>/status, and ps uses (is mislead by) /proc/<pid>/status

Where do I complain now?? Could someone please reroute this appropriately?
Thanks, AG
Comment 3 Karel Zak 2005-11-15 09:12:30 EST
Yes, ps uses /proc/<pid>/status.

You can check difference by command:

for i in `ps -A -opid=`; do if [ `grep -c VmSize /proc/$i/status` -eq 0 ]; then
continue; fi; awk '/Name:/ { printf("%-25s", $2) }' /proc/$i/status; a=`awk '{
print $23 / 1024 }' /proc/$i/stat`; b=`awk '/VmSize:/ { printf $2 }'
/proc/$i/status`; echo "$a - $b" | bc -l; done 2> /dev/null

 I think you will found that there's difference only for X server, because 
VmSize = memory + memory-mapped hardware (e.g. video card memory).

Closing as NOTABUG.

Note You need to log in before you can comment on or make changes to this bug.