Dear all:
I have some questions about virtual memory (VM) subsystem of the Linux
kernel.
1. From linux doc, there is drop_caches in /proc/ which can let us to
free the cache that kernel used, such as dentries and inodes, etc.
I know i can echo 1, 2 or 3 to free different level of caches in the
linux kernel, but is there any more elegant or programming rule that I
can follow to let it used more efficiently?
2. what kind of system call will increase the size of cache?
I write a test program as below but from top, the size of cache seems
no change
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int index;
char input;
char * point[1024];
for(index=0;index<1024;index++)
{
point[index]=malloc(1024*1024);
printf("please input any charter for going down:\n");
scanf("%c",&input);
}
}
the memory usage of test.mips increased but the cached size is always
4916k as below:
Mem: 8352K used, 132800K free, 0K shrd, 60K buff, 4916K cached
Load average: 0.00 0.00 0.00
PID USER STATUS VSZ PPID %CPU %MEM COMMAND
400 0 SW 668 1 0.3 0.4 busybox.telnetd
498 0 RW 584 408 0.3 0.4 top
500 0 SW 10156 317 0.0 7.1 test.mips
317 0 SW 596 1 0.0 0.4 sh
408 0 SW 592 400 0.0 0.4 sh
1 0 SW 584 0 0.0 0.4 init
5 0 SW< 0 2 0.0 0.0 khelper
86 0 SW< 0 2 0.0 0.0 khubd
3 0 SW< 0 2 0.0 0.0 ksoftirqd/0
76 0 SW< 0 2 0.0 0.0 kblockd/0
4 0 SW< 0 2 0.0 0.0 events/0
2 0 SW< 0 0 0.0 0.0 kthreadd
112 0 SW 0 2 0.0 0.0 pdflush
113 0 SW< 0 2 0.0 0.0 kswapd0
8 0 SW< 0 2 0.0 0.0 async/mgr
116 0 SW< 0 2 0.0 0.0 crypto/0
252 0 SW< 0 2 0.0 0.0 mtdblockd
254 0 SW< 0 2 0.0 0.0 nftld
255 0 SW< 0 2 0.0 0.0 inftld
286 0 SW< 0 2 0.0 0.0 rpciod/0
253 0 SW< 0 2 0.0 0.0 ftld
89 0 SW< 0 2 0.0 0.0 kseriod
111 0 SW 0 2 0.0 0.0 pdflush
448 0 SW< 0 2 0.0 0.0 scsi_eh_1
449 0 SW< 0 2 0.0 0.0 usb-storage
114 0 SW< 0 2 0.0 0.0 nfsiod
115 0 SW< 0 2 0.0 0.0 cifsoplockd
Mem: 8352K used, 132800K free, 0K shrd, 60K buff, 4916K cached
Load average: 0.04 0.01 0.00
PID USER STATUS VSZ PPID %CPU %MEM COMMAND
501 0 RW 584 408 0.5 0.4 top
400 0 SW 668 1 0.3 0.4 busybox.telnetd
500 0 SW 37912 317 0.0 26.8 test.mips
317 0 SW 596 1 0.0 0.4 sh
408 0 SW 592 400 0.0 0.4 sh
1 0 SW 584 0 0.0 0.4 init
5 0 SW< 0 2 0.0 0.0 khelper
86 0 SW< 0 2 0.0 0.0 khubd
3 0 SW< 0 2 0.0 0.0 ksoftirqd/0
76 0 SW< 0 2 0.0 0.0 kblockd/0
4 0 SW< 0 2 0.0 0.0 events/0
2 0 SW< 0 0 0.0 0.0 kthreadd
112 0 SW 0 2 0.0 0.0 pdflush
113 0 SW< 0 2 0.0 0.0 kswapd0
8 0 SW< 0 2 0.0 0.0 async/mgr
116 0 SW< 0 2 0.0 0.0 crypto/0
252 0 SW< 0 2 0.0 0.0 mtdblockd
254 0 SW< 0 2 0.0 0.0 nftld
255 0 SW< 0 2 0.0 0.0 inftld
286 0 SW< 0 2 0.0 0.0 rpciod/0
253 0 SW< 0 2 0.0 0.0 ftld
89 0 SW< 0 2 0.0 0.0 kseriod
111 0 SW 0 2 0.0 0.0 pdflush
448 0 SW< 0 2 0.0 0.0 scsi_eh_1
449 0 SW< 0 2 0.0 0.0 usb-storage
114 0 SW< 0 2 0.0 0.0 nfsiod
115 0 SW< 0 2 0.0 0.0 cifsoplockd
appreciate your kind help,
miloody
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ