LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-30-2005, 01:21 AM   #1
damonnew
LQ Newbie
 
Registered: Jan 2005
Posts: 1

Rep: Reputation: 0
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!
 
Old 01-30-2005, 01:51 AM   #2
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Århus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 619

Rep: Reputation: 45
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox gets stuck... top shows 98-99% memory usage amitsharma_26 Linux - General 26 12-28-2005 03:01 PM
tmpfs and swap memory basics kushalkoolwal Debian 1 09-12-2005 04:24 PM
valgrind reports un-free'd memory in crypt()? Xagafinelle Programming 3 08-21-2004 11:02 AM
Memory usage reported using TOP Kdiver58 Linux - Newbie 1 02-03-2003 01:31 PM
Top reports > 100% Memory use by X sparky6969 Linux - General 2 07-20-2001 09:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration