virtual memory

Tolga Evren tolgae at paro.com.tr
Wed Nov 30 08:50:24 UTC 2005


Hi , 

I have been dealing with virtual memory for a couple of time , have 
asked questions about this in newsgroups , i have one more subject 
which i need to understand. All comments will ve wellcomed. 

My system is redhat linux 2.1 advanced server , itanium  , I have 
oracle running on this server , oracle data files reside in OCFS 
(oracle clustered file system ) ,  other file systems are ext3. Ocfs is 
a special file system developed by oracle , it uses direct IO by 
default. 

I have 8GB. Ram and 4 ia64 cpus. 

For a long time , I have been checking the systems virtual memory usage 
by using sar -B , sar -W , sar -R . 

What I see is , I have always nonzero pagein and out values: 

[oracle at tanidw1 bdump]$ cat /proc/meminfo 

        total:    used:    free:  shared: buffers:  cached: 
Mem:  8490827776 7971651584 519176192        0 60014592 3406364672 
Swap: 25165725696 53788672 25111937024 
MemTotal:      8291824 kB 
MemFree:        507008 kB 
MemShared:           0 kB 
Buffers:         58608 kB 
Cached:        3323872 kB 
SwapCached:       2656 kB 
Active:        3041504 kB 
Inact_dirty:   2149536 kB 
Inact_clean:      2496 kB 
Inact_target:  1038704 kB 
HighTotal:           0 kB 
HighFree:            0 kB 
LowTotal:      8291824 kB 
LowFree:        507008 kB 
SwapTotal:    24575904 kB 
SwapFree:     24523376 kB 
Committed_AS: 49056320 kB 
HugePages_Total:     0 
HugePages_Free:      0 
Hugepagesize:    262144 kB 

[oracle at tanidw1 bdump]$ sar -B 1 10 
Linux 2.4.18-e.37smp (tanidw1)  11/07/2005 

10:17:41 AM  pgpgin/s pgpgout/s  activepg  inadtypg  inaclnpg  inatarpg 
10:17:42 AM  28787.00  27500.00    191039    134350       261     65130 
10:17:43 AM  32485.00  20731.00    190990    134350       260     65120 
10:17:44 AM  33271.00  18399.00    191359    134350       256     65193 
10:17:45 AM  27020.00  31023.00    191358    134351       256     65193 
10:17:46 AM  33820.00  23518.00    191440    134351       256     65209 
10:17:47 AM  36264.00  13263.00    191430    134355       262     65209 
10:17:48 AM  32956.00  24286.00    191402    134383       262     65209 
10:17:49 AM  29708.00  30026.00    191475    134388       264     65225 
10:17:50 AM  33324.00  20191.00    191506    134389       264     65231 
10:17:50 AM  pgpgin/s pgpgout/s  activepg  inadtypg  inaclnpg  inatarpg 
10:17:51 AM  31308.00  21341.00    191202    134529       264     65199 
Average:     31894.30  23027.80    191320    134380       260     65192 

[oracle at tanidw1 bdump]$ sar -r 1 10 
Linux 2.4.18-e.37smp (tanidw1)  11/07/2005 
10:18:07 AM kbmemfree kbmemused  %memused kbmemshrd kbbuffers  kbcached 
kbswpfree kbswpused  %swpused 
10:18:08 AM    489280   7802544     94.10         0     54768   3330896 
 24523376     52528      0.21 
10:18:09 AM    489280   7802544     94.10         0     54768   3330896 
 24523376     52528      0.21 
10:18:10 AM    487728   7804096     94.12         0     54800   3330896 
 24523376     52528      0.21 
10:18:11 AM    484352   7807472     94.16         0     54800   3330896 
 24523376     52528      0.21 
10:18:12 AM    452688   7839136     94.54         0     54752   3331072 
 24523376     52528      0.21 
10:18:13 AM    400336   7891488     95.17         0     54752   3331072 
 24523376     52528      0.21 
10:18:14 AM    395936   7895888     95.22         0     54768   3331072 
 24523376     52528      0.21 
10:18:15 AM    398752   7893072     95.19         0     54816   3331056 
 24523376     52528      0.21 
10:18:16 AM    401168   7890656     95.16         0     54816   3331056 
 24523376     52528      0.21 
10:18:16 AM kbmemfree kbmemused  %memused kbmemshrd kbbuffers  kbcached 
kbswpfree kbswpused  %swpused 
10:18:17 AM    370432   7921392     95.53         0     54816   3331904 
 24523376     52528      0.21 
Average:       436995   7854829     94.73         0     54786   3331082 
 24523376     52528      0.21 

Based on these outputs , what I see is , the kbcached value does not 
change , (I have also disk io  , although I don't get it here , 
iostat shows it) so I consider this io as direct IO. 

On the other hand , sar -B shows high values of   pgpgin/s pgpgout/s 
. I am trying to understand the reason of paging activity. Is it 
because of caching disk pages inside the page cache  , or because of 
anonymous pages or other type of virtual memory pages? 

 ( I have read some stuffs considering virtual memory , including the 
types of virtual memory pages , so I am familiar with the concept) 

At first I thought that this paging activity occurs because of disk io. 
The data that is read from the disk is cached inside tha page cache and 
although ocfs is assumed to use direct IO , may be it is not. But after 
checking the sar -r , I decided that it was not. The kbcached value 
is always same (it does not increase when oracle reads data from disk , 
but it increases when i read files by using dd ) so page cache can  not 
the reason of this paging activity .( On sun solaris , vmstat -p 
shows detailed paging activity , so it is easy to see the reason of 
paging , but on linux I have only sar -r) 

Some one told me that , direct IO is direct IO , application does its 
own file caching , and this creates paging activity . ( I do really 
don't understand what does this mean? ) 

On the other hand , although I see pageout values, iostat does not show 
any io through the swap devices!  So this makes me thing that , pageout 
occurs directly to the files itself  , and this can happen when virtual 
memory maps pages directly form the files instead of swap files and 
this type of mapping can occur for file data not for anon pages . 

How can i get more info about the detailed virtual memory usage? Is 
there any tool? Or is there any system functions that i can use with 
c++ or etc which lists the process's paging -out details?I have found 
the gormans 'understanding linux virtual memory book' which is more 
than 700 pages. Studying this book can be helpful ,but I will be 
appreciated if you can help me in order to clarify this issue. 

Kind Regards, 

tolga 

 




More information about the redhat-list mailing list