LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   top reports 99% memory used when using a tmpfs (https://www.linuxquestions.org/questions/linux-general-1/top-reports-99-memory-used-when-using-a-tmpfs-283956/)

damonnew 01-30-2005 01:21 AM

top reports 99% memory used when using a tmpfs
 
I'm creating a 9GB tmpfs to hold read only database tables which occupy 5.7GB of disk space. The machine I'm working on has 12GB of memory and after these 5.7GB of data are copied to the tmpfs, top displays 11.9GB used. Before the copy, top displays 255MB of memory being used. I expected to see approximately of 6GB memory used. How is this process using 99% of my total memory when it should be using 50%? I have tried to create the ramdisk in the following ways and all produce the same result:

1) mount -t tmpfs -o size=9g aramdisk /mnt/ramdisk

2) mke2fs -m0 -b 1024 /dev/ram0
mount -t tmpfs -o size=9g /dev/ram0 /mnt/ramdisk

3) in grub.conf add: ramdisk_size=9216000
mke2fs -m0 -b 1024 /dev/ram0
mount -t ext2 /dev/ram0 /mnt/ramdisk

...and then simply copy the data to /mnt/ramdisk. When all data is deleted from the tmpfs directory and then unmounted, the available memory doesn't return back to what it was before the copy took place, I have to reboot.

The memory results from the above tests reveal:
1)
top results:
Mem: 11993532k av, 11983504k used, 10028k free, 0k shrd, 14816k buff
6260108k actv, 4364568k in_d, 218348k in_c
Swap: 2040244k av, 3016k used, 2037228k free 11786364k cached

2)
top results:
Mem: 11993532k av, 11983636k used, 9896k free, 0k shrd, 14864k buff
8612480k actv, 2555068k in_d, 225340k in_c
Swap: 2040244k av, 1316k used, 2038928k free 11787232k cached

df results:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/ram0 9437184 6079224 3357960 65% /mnt/ramdisk

3)
top results:
Mem: 11993532k av, 11980460k used, 13072k free, 0k shrd, 109328k buff
1362620k actv, 7477788k in_d, 204740k in_c
Swap: 2040244k av, 0k used, 2040244k free 10842832k cached

df results:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/ram0 9069194 6102747 2966447 68% /mnt/ramdisk


*** Can anyone provide some insite on what is going on and what I'm doing wrong? Thanks!

otoomet 01-30-2005 01:51 AM

Nothing is probably wrong. 6GB of your memory is used by data. Another 6GB is used by disk caches, I guess. Linux keeps everything it reads from disk in memory until the memory is needed for something else. Top shows always 99% memory usage, except just after boot.

Best,

Ott


All times are GMT -5. The time now is 04:20 PM.