Operating System - HP-UX
1752798 Members
5798 Online
108789 Solutions
New Discussion юеВ

Reporting physical memory (machinfo vs vparstatus/kmeminfo)

 
SOLVED
Go to solution
Jan-Erik Sanne
Advisor

Reporting physical memory (machinfo vs vparstatus/kmeminfo)

Hi all,

Does anyone knows why machinfo, dmesg, print_manifest, ... does not report all physical memory? vparstatus does. Also kmeminfo.

11.31 vpar rx7640
$ machinfo
Memory: 4046 MB (3.95 GB)

$ print_manifest |grep "Main Memory"
Main Memory: 4046 MB

$ dmesg | grep Phys
Physical: 4144088 Kbytes
$ echo "4144088/1024"|bc
4046


But vparstatus and kmeminfo shows 'all the memeory':
$ vparstatus | grep -e "Total MB" -e "avd_b"

vPar Name Ranges/MB Total MB
avd_b 0/ 0 4096 <<==correct!

$ kmeminfo | grep Phys
Physical memory usage summary (in page/byte/percent):
Physical memory = 1036022 4.0g 100% <<==correct!

Same thing with 11.23

11.23 rx1600
$ machinfo
Memory = 10229 MB (9.989258 GB) #why not 10GB?

$ /opt/ignite/bin/print_manifest | grep "Main Memory"
Main Memory: 10229 MB

$ dmesg | grep Phys
Physical: 10474800 Kbytes
$ echo "10474800 / 1024"|bc
10229
SHOULD HAVE BEEN 10240

$ kmeminfo | grep Phys
Physical memory usage summary (in page/byte/percent):
Physical memory = 2618700 10.0g 100%

Cheers,
janerik
Life is not life unless you make mistakes
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Reporting physical memory (machinfo vs vparstatus/kmeminfo)

Shalom,

You will be surprised to find a number of variances in how things are calculated in utilities

Memory: 4046 MB (3.95 GB)

Divide 4046 by 1024 to get GB.
3.951171875

That calculation seems consistent, but that is not always the case.

Memory = 10229 MB (9.989258 GB) #why not 10GB?

The factor you seem to miss here is its not 1000 MB to a GB, it 1024.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jan-Erik Sanne
Advisor

Re: Reporting physical memory (machinfo vs vparstatus/kmeminfo)

Hi Steven,

I'm aware of the factor of 1024MB in 1 GB. See my calulations in the 'echo' commands above.
What puzzels me is that this memory listing is constantly wrong in more or less all HP-UX commands. vparstatus and kmeminfo lists the correct value. The correct value is also listed by cstm:
echo "#cpu info"
echo "selclass qualifier cpu;info;wait;infolog"|cstm
echo "#memory information"
echo "selclass qualifier memory;info;wait;infolog"|cstm

Br,
janerik
Life is not life unless you make mistakes
Don Morris_1
Honored Contributor
Solution

Re: Reporting physical memory (machinfo vs vparstatus/kmeminfo)

Sorry -- kmeminfo reports 1036022 _pages_ above. 4Kb per page means that's 4144088 Kb... exactly what dmesg and machinfo reported.

So no, this isn't inconsistent. What's missing is pages stolen for firmware code caches, the vPar Monitor/Guest intercommunication, etc. In other words, RAM the OS doesn't get to use for itself in the first place... hence why the OS based utilities don't report it.
Arturo Galbiati
Esteemed Contributor

Re: Reporting physical memory (machinfo vs vparstatus/kmeminfo)

Hi,
try this get RAM size in KB
perl -e 'local($PSTAT,$PSTAT_STATIC,$mem_info,$PSTAT_STRUCT)=(239,2,"\0"x120,"LI4L");
syscall($PSTAT,$PSTAT_STATIC,$mem_info,length($mem_info),1,0);
print "RAM=".int((unpack($PSTAT_STRUCT,$mem_info))[4]*((unpack($PSTAT_STRUCT,$mem_info))[5])/(1024*1024))."\n";'

HTH,
Art
Jan-Erik Sanne
Advisor

Re: Reporting physical memory (machinfo vs vparstatus/kmeminfo)

Thx guys,
janerik
Life is not life unless you make mistakes