How to check page out and memory (SAR-G)
Use the SAR-G command to display an average page out and memory release activity.
$ sar-g
00:00:00 pgout/s ppgout/s pgfree/s pgscan/s%ufs_ipf
01:00:00 0.00 0.00 0.00 0.00 0.00
The output of the SAR-G command can clearly indicate whether more memory is required. Use the ps-elf command to display the number of cycles used by the page daemon. If the number of cycles is large and the values of the pgfree/s and PGSCAN/S fields are large, it indicates that there is not enough memory.
The Sar-g command also indicates whether the rate of retrieval of the inode is too fast to cause a reusable page loss.
Sample 13–8 Check page out and memory (SAR-G)
The following example displays the output of the SAR-G command.
$ sar-g
SunOS balmyday 5.10 s10_51 sun4u 03/18/2004
00:00:00 pgout/s ppgout/s pgfree/s pgscan/s%ufs_ipf
01:00:00 0.00 0.00 0.00 0.00 0.00
02:00:00 0.01 0.01 0.01 0.00 0.00
03:00:00 0.00 0.00 0.00 0.00 0.00
04:00:00 0.00 0.00 0.00 0.00 0.00
05:00:00 0.00 0.00 0.00 0.00 0.00
06:00:00 0.00 0.00 0.00 0.00 0.00
07:00:00 0.00 0.00 0.00 0.00 0.00
08:00:00 0.00 0.00 0.00 0.00 0.00
08:20:01 0.00 0.00 0.00 0.00 0.00
08:40:00 0.00 0.00 0.00 0.00 0.00
09:00:00 0.00 0.00 0.00 0.00 0.00
09:20:01 0.05 0.52 1.62 10.16 0.00
09:40:01 0.03 0.44 1.47 4.77 0.00
10:00:02 0.13 2.00 4.38 12.28 0.00
10:20:03 0.37 4.68 12.26 33.80 0.00
Average 0.02 0.25 0.64 1.97 0.00
The following table describes the output of the-G option.
Field name |
Description |
pgout/s |
Number of page requests per second. |
ppgout/s |
The actual number of pages paged out per second. A single page out request may involve paging of multiple pages. |
pgfree/s |
Number of pages placed in the available list per second. |
pgscan/s |
Number of pages scanned per second by the page daemon. If this value is large, the page daemon spends a significant amount of time checking available memory. This scenario implies that more memory may be required. |
%ufs_ipf |
The percentage of a ufs inode that has the iget of the associated reusable page removed from the available list. These pages are refreshed and cannot be reclaimed by the process. Therefore, this field represents the percentage of the igets that has page refreshes. If the value is large, the available list pages for the inode are dense, and you may need to increase the number of UFS inode. |
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/unix/
Check kernel memory allocation
KMA allows kernel subsystems to allocate and free memory as needed.
Instead of statically allocating the maximum amount of memory that is expected under peak load, the KMA is divided into three categories:
Small (less than 256 bytes)
Large (512 bytes to 4,000 bytes)
Super Large (greater than 4,000 bytes)
KMA reserves two memory pools to meet small and large requests. A very large request is satisfied by allocating memory from the system page allocator.
Sar-k commands can be useful if the system you are checking is used to write drivers or STREAMS that use KMA resources. Otherwise, you may not need the information it provides. All drivers or modules that use KMA resources but do not necessarily return resources before exiting may generate a memory leak. A memory leak can cause the amount of memory allocated by KMA to increase with the event. Therefore, if the Alloc field of the Sar-k command increases steadily over time, a memory leak may exist. Another condition that indicates a memory leak is a request failure. If this problem occurs, a memory leak is likely to cause KMA to retain and allocate memory.
If there appears to be a memory leak, check all drivers or STREAMS that may be requesting memory from KMA but not returning memory.
How to check kernel memory allocation (SAR-K)
Use the Sar-k command to report the following activities for the kernel memory allocator (Kernel Memory allocator, KMA).
$ sar-k
00:00:00 Sml_mem alloc fail Lg_mem alloc fail Ovsz_alloc fail
01:00:00 2523136 1866512 0 18939904 14762364 0 360448 0
02:00:02 2523136 1861724 0 18939904 14778748 0 360448 0
Sample 13–9 Check kernel memory allocation (SAR-K)
The following is an abbreviated example of sar-k output.
$ sar-k
SunOS balmyday 5.10 s10_51 sun4u 03/18/2004
00:00:04 Sml_mem alloc fail Lg_mem alloc fail Ovsz_alloc fail
01:00:00 6119744 4852865 0 60243968 54334808 156 9666560 0
02:00:01 6119744 4853057 0 60243968 54336088 156 9666560 0
03:00:00 6119744 4853297 0 60243968 54335760 156 9666560 0
04:00:00 6119744 4857673 0 60252160 54375280 156 9666560 0
05:00:00 6119744 4858097 0 60252160 54376240 156 9666560 0
06:00:00 6119744 4858289 0 60252160 54375608 156 9666560 0
07:00:00 6119744 4858793 0 60252160 54442424 156 9666560 0
08:00:00 6119744 4858985 0 60252160 54474552 156 9666560 0
08:20:00 6119744 4858169 0 60252160 54377400 156 9666560 0
08:40:01 6119744 4857345 0 60252160 54376880 156 9666560 0
09:00:00 6119744 4859433 0 60252160 54539752 156 9666560 0
09:20:00 6119744 4858633 0 60252160 54410920 156 9666560 0
09:40:00 6127936 5262064 0 60530688 55619816 156 9666560 0
10:00:00 6545728 5823137 0 62996480 58391136 156 9666560 0
10:20:00 6545728 5758997 0 62996480 57907400 156 9666560 0
10:40:00 6734144 6035759 0 64389120 59743064 156 10493952 0
11:00:00 6996288 6394872 0 65437696 60935936 156 10493952 0
Average 6258044 5150556 0 61138340 55609004 156 9763900 0