Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why is swap being used?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Crisis
l33t
l33t


Joined: 10 Feb 2003
Posts: 613
Location: Portland, OR

PostPosted: Fri Apr 16, 2004 7:44 pm    Post subject: Why is swap being used? Reply with quote

Seems I keep swapping out space even though mem is free:

Code:
             total       used       free     shared    buffers     cached
Mem:            89         73         15          0         12         23
-/+ buffers/cache:         38         51
Swap:          256         40        216


Any idea why?
Back to top
View user's profile Send private message
Anime_Fan
Guru
Guru


Joined: 01 Jul 2003
Posts: 366
Location: Linköping, Sweden

PostPosted: Fri Apr 16, 2004 8:02 pm    Post subject: Reply with quote

Used memory isn't freed.
You probablt were using more memory than your RAM could handle at one point. Thus, it will say that you use(d) swap.
Back to top
View user's profile Send private message
Crisis
l33t
l33t


Joined: 10 Feb 2003
Posts: 613
Location: Portland, OR

PostPosted: Fri Apr 16, 2004 8:39 pm    Post subject: Reply with quote

Is there any way to see the current swap usage?

Also, why would memory show as 89 instead of the 96 I have?

Thanks!
Back to top
View user's profile Send private message
Nate_S
Guru
Guru


Joined: 18 Mar 2004
Posts: 414

PostPosted: Fri Apr 16, 2004 11:42 pm    Post subject: Reply with quote

the mem amount thing I think is the difference between "salesman's megs" and real megs showing up, 1000 vs 2^10=1024

I'd also like to know if you can see current swap usage.
Back to top
View user's profile Send private message
sapphirecat
Guru
Guru


Joined: 15 Jan 2003
Posts: 376

PostPosted: Sat Apr 17, 2004 1:35 am    Post subject: Reply with quote

Crisis wrote:
Is there any way to see the current swap usage?


free is showing the current swap usage; stuff may have been pushed out to swap earlier and not used since, so the kernel sees no point in bringing it in. It can't see the future, so it can't tell whether it should swap stuff in, or whether some running process may want another 10 MB of RAM soon.

Quote:
Also, why would memory show as 89 instead of the 96 I have?


The chunk of memory the kernel lives in can't be swapped out, so it won't show up as usable memory.
_________________
Former Gentoo user; switched to Kubuntu 7.04 when I got sick of waiting on gcc. Chance of thread necro if you reply now approaching 100%...
Back to top
View user's profile Send private message
speed_bump
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2004
Posts: 92
Location: Wisconsin, USA

PostPosted: Sat Apr 17, 2004 1:57 pm    Post subject: Reply with quote

Another possible reason for seeing 89 megs instead of 96 may be that your video card is "sharing" memory with the system. That is, instead of having its own physical memory, the video card is using some of your system's memory. Your BIOS should tell you if that's the case.
Back to top
View user's profile Send private message
Souperman
Guru
Guru


Joined: 14 Jul 2003
Posts: 449
Location: Cape Town, South Africa

PostPosted: Sun Apr 18, 2004 9:23 am    Post subject: Reply with quote

The "lost" memory is used by the kernel. As you can see, mine show 503 total instead of 512. I don't have onboard VGA which could share memory.
Code:

root@desktop[pts/21]:/root# free -m
             total       used       free     shared    buffers     cached
Mem:           503        350        153          0         44        210
-/+ buffers/cache:         95        408
Swap:          980          1        978

_________________
moo
Back to top
View user's profile Send private message
speed_bump
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2004
Posts: 92
Location: Wisconsin, USA

PostPosted: Sun Apr 18, 2004 5:19 pm    Post subject: Reply with quote

Another thing to be aware of (getting back to the original question) is that the kernel will try to keep a certain percentage of RAM free in order to mitigate possible thrashing and deadlock scenarios. So in small memory configurations, it's very possible to have swap used even though there is RAM available.

In general, the kernel will try to move pages to swap that have not been used recently so this isn't a big deal. However, "recently" is an vague term and on a very busy system "recently" might be on the order of seconds rather than minutes or hours.

Is this causing you problems?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum