Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bad swap usage
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
drakonite
l33t
l33t


Joined: 02 Nov 2002
Posts: 768
Location: Lincoln, NE

PostPosted: Wed Mar 05, 2003 12:13 am    Post subject: Bad swap usage Reply with quote

When ever my computer starts hitting swap the performance goes waay down. I know swap is slower than RAM but that's not the problem. The swap performance is terrible.

Programs go from running fairly nice when there is enough RAM, to taking as much as 30 secs to refresh the window when the computer is hitting swap.

Any ideas what the problem is?
_________________
Shoot Pixels Not People

My GPG/PGP Public key
Back to top
View user's profile Send private message
Jimbow
Guru
Guru


Joined: 18 Feb 2003
Posts: 597
Location: Silver City, NM

PostPosted: Wed Mar 05, 2003 1:33 am    Post subject: Reply with quote

1) use the free or top commands to see how much of your swap is being used.

2) I've run into the same thrashing and speed problems when my swap was getting full. I think I was running a program with a memory leak.

3) Are you sure the performance suffers when swap is being used (I can't notice the difference on my machine) or when it starts to get full?

4) How much RAM have you and what is your base system: X? Gnome? KDE? I am getting by running KDE with 256M but I have more RAM on the way.
Back to top
View user's profile Send private message
ebrostig
Bodhisattva
Bodhisattva


Joined: 20 Jul 2002
Posts: 3152
Location: Orlando, Fl

PostPosted: Wed Mar 05, 2003 2:05 am    Post subject: Reply with quote

Any time the system starts swapping, performance will go down.

When that is said, I have seen machines (RedHat Advanced Server 2.1) where I after a few days without no activity at all, just by sitting there started to swap so heavily that I could not access the machine at all. I left it running for about 5 days to see if it finally would crash so I could get an idea of what caused it but it never crashed and I had to pull the plug. From previous experience, hitting heavy swapping can sometimes lead to completely halting activity since the only task getting CPU is the process that tries to move pages in and out of memory, traversing the linked lists of least recently used blocks and moving the back and forth. A terrible waste of system resources.

Often this behaviour is caused by memory leaks, bad programming or even kernel bugs.

Erik
_________________
'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
Back to top
View user's profile Send private message
Accipiter
Tux's lil' helper
Tux's lil' helper


Joined: 24 Feb 2003
Posts: 88
Location: Buffalo, NY

PostPosted: Wed Mar 05, 2003 2:44 am    Post subject: Well, it wasn't intended for this sort of thing Reply with quote

Linux seems to have its issues with memory management in general. I've seen cases (frequent... very frequent cases) where the system won't even touch swap at all until the RAM is very nearly full (~5-7%). This is the case with my system, and I have approx. 700MB of DDR. A friend of mine and I were talking about this just yesterday... it seems like this isn't an abnormal occurrence at all. If only the kernel were able to schedule paging more efficiently (anticipating situations while your physical memory isn't bloody maxed out)... :roll:
Back to top
View user's profile Send private message
drakonite
l33t
l33t


Joined: 02 Nov 2002
Posts: 768
Location: Lincoln, NE

PostPosted: Wed Mar 05, 2003 3:06 am    Post subject: Reply with quote

Jimbow wrote:
1) use the free or top commands to see how much of your swap is being used.

Very little. I looked earlier (before restarting) and I think it said 44MB, and it had been thrashing into the swap (running at an ususable speed) for the past couple hours.

Quote:
2) I've run into the same thrashing and speed problems when my swap was getting full. I think I was running a program with a memory leak.

Still had plenty of swap space. I set my swap partition to 512MB, so it should have plenty of room...

Quote:
3) Are you sure the performance suffers when swap is being used (I can't notice the difference on my machine) or when it starts to get full?

Yeah, I am sure. According to free there is plenty of free swap space. That is why I am asking because I know that it should be performing a lot better.

Quote:
4) How much RAM have you and what is your base system: X? Gnome? KDE? I am getting by running KDE with 256M but I have more RAM on the way.

192MB with E. Much less of a memory hog than KDE is... It usually doesn't hit the swap space until I've gotten lots of things going through it, I am pretty sure there is a memory leak somewhere but I'm not sure where. Even with the memory leak it should still work fine when it starts to swap as long as it doesn't fill up the swap space... But with a few seconds of delay when ever you hit a key it's not even usable.
_________________
Shoot Pixels Not People

My GPG/PGP Public key
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Wed Mar 05, 2003 3:22 am    Post subject: Reply with quote

I have had simmilar problems. I was told to try the vanilla 2.4.20 kernel for agp reasons mostly. the memory usage still seems to keep growing without much hapenning but the other day before I switched to the 2.4.21_pre5-gss souces I saw swap usage going very high & the system showed no slowdown. So I pushed it up to 224Mb swap used with no noticeable affect.
It had using gentoo sources 2.4.19 kernel, the system nearly halted when it was at 112Mb swap. {my sys = 256Mb ram, 2-256MB swap partiions on diferent drives}. From what I read in the forums the problem usually shows itself when you near half your swap size {my case it was half my first swap partiton}.

The best thing I did was to set xscreensaver to blank screen only, otherwise the running process seems to push over the top if it runs overnight. I haven't noticed any problems yet with this new kernel (a few other stability bugs to iron out still), but I frequently shutdown this system so my young daughter can run her windows games.

Brian
Back to top
View user's profile Send private message
ebrostig
Bodhisattva
Bodhisattva


Joined: 20 Jul 2002
Posts: 3152
Location: Orlando, Fl

PostPosted: Wed Mar 05, 2003 4:20 am    Post subject: Reply with quote

Oh, talking about Xscreensaver...

I had emerged the glx_rss (not sure if it is the right name) additional screensavers to be used with XScreensaver, these are OpenGL based and pretty awesome looking. The main problem however was that they never terminated any of the screensavers after use, They were stuck in memory and I had to kill each of them with kill -9. They also used a lot of memory and actually contributed to my 1GB RAM box started swapping. I unmerged them and have not seen swapping since.

I'm currently running 3 Oracle 9.2 instances, each using about 200MB of RAM along with X 4.3 and KDE 3.1 and several company specific Java based apps. No swapping at all.

Erik
_________________
'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
Back to top
View user's profile Send private message
drakonite
l33t
l33t


Joined: 02 Nov 2002
Posts: 768
Location: Lincoln, NE

PostPosted: Wed Mar 05, 2003 12:50 pm    Post subject: Reply with quote

I am not sure what to think now... I KNOW free was telling me that I wasn't using my swap usually, and I KNOW it alwasy says a low number of swap usage (44MB earlier) when the computer is slowing down, but after doing something it's now telling me I'm using about 150MB of swap space, and everything is running fine.

Apparentlly you were right and it was running out of swap space... but free sure didn't want to tell me.

Meh... Now I either need to figure out what program is leaking the memory and quit using it, or find some spare harddrive space for swap and maybe add some RAM ;)

Thanks for you help.
_________________
Shoot Pixels Not People

My GPG/PGP Public key
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Wed Mar 05, 2003 9:52 pm    Post subject: Reply with quote

The other threads that I found info on were about chipset support, etc. One of the theories was nvidia drivers causing memory leakage, but my system seems to be running stable now even with an unproven new kernel source and nvidia 4191 drivers. Most of my troubles seemed to stem from proper kernel config for my chipsets agp and sound. Time will tell if it rears its slowness again for me.

Ram prices around here are dropping quite low, so I think I will be picking up some more soon. Then to back up everything and repartion my drives for more swap space.

[edit] here is the link to one of the forum topics I found:https://forums.gentoo.org/viewtopic.php?t=32334

Brian
Back to top
View user's profile Send private message
Jimbow
Guru
Guru


Joined: 18 Feb 2003
Posts: 597
Location: Silver City, NM

PostPosted: Sun Mar 09, 2003 3:56 am    Post subject: Reply with quote

I sent email to Nvidia about the memory leak problems being seen here. Andy (from Nvidia) sent me a patch that fixed bug #15935 (on my system). This bug reported a memory leak running GLX screensavers on nvidia hardware.

The patch worked for me with gentoo-sources-2.4.20-r1. YMMVG because the patched code does not exist in (for example) the vanilla-2.4.20 sources.

I added the patch to the bug report, but I will list it here too. I am currently using the Nvidia 4191 drivers and I'm on a Dell i8200 with a GeForce2 Go video controller.

Code:

diff -ru linux-2.4.20-2.48/mm/page_alloc.c linux-2.4.20-6/mm/page_alloc.c
--- linux-2.4.20-2.48/mm/page_alloc.c 2003-02-13 08:31:30.000000000 -0800
+++ linux-2.4.20-6/mm/page_alloc.c 2003-02-27 06:33:37.000000000 -0800
@@ -98,13 +106,13 @@
lru_cache_del(page);
}

- /*
- * This late check is safe because reserved pages do not
- * have a valid page->count. This trick avoids overhead
- * in __free_pages().
- */
- if (PageReserved(page))
- return;
+
+
+
+
+
+
+
if (page->buffers)
BUG();
if (page->mapping) {
@@ -654,7 +662,7 @@

void __free_pages(struct page *page, unsigned int order)
{
- if (put_page_testzero(page))
+ if (!PageReserved(page) && put_page_testzero(page))
__free_pages_ok(page, order);
}
Back to top
View user's profile Send private message
Zork the Almighty
n00b
n00b


Joined: 29 May 2003
Posts: 10

PostPosted: Tue Jun 17, 2003 10:14 pm    Post subject: hdparm Reply with quote

just a little reminder, if system performance when swapping sucks more than usual, be sure you have your hard disk tuned with hdparm.
Back to top
View user's profile Send private message
aurelianis
n00b
n00b


Joined: 28 May 2003
Posts: 15
Location: Ann Arbor, MI

PostPosted: Thu Jun 19, 2003 3:59 pm    Post subject: Reply with quote

Have to agree with you on the XScreensaver issues - I've got 512MB of DDR with a 1.5GB swap partition. When I boot the computer and let it run for about 10 minutes, Gnome, Apache, etc. uses around 20-30% of RAM. Open Mozilla, Evolution, and a couple other programs, and it gets up to 60-70%. But once XScreensaver kicks in, my RAM usage goes to 100%. Checked the system monitor after I quit the screensaver - it still listed a GL screensaver process (GLFlux - one of the screen-capture ones) that was using ***137MB*** of RAM!!!! Even when I kill it, my physical mem is only about 5% free and I eventually have to restart because it starts swapping like mad. Memory leak somewhere, but I don't know where to look for it. Everything's pretty up-to-date because I just re-installed the system about 3 weeks ago.
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