View previous topic :: View next topic |
Author |
Message |
Ypsilon Tux's lil' helper
Joined: 19 Jul 2002 Posts: 92 Location: Germany
|
Posted: Mon Dec 19, 2005 6:33 pm Post subject: Something must be wrong with my kernel concerning priorities |
|
|
Hello guys,
I have an AMD64 system that is totally up-to-date. I use kernel 2.6.14-nitro2 and reiser4 which are both said to be unbelievable fast.
Additionally, I use
CFLAGS="-march=athlon64 -O3 -ftracer -fomit-frame-pointer -fforce-addr -ffast-math -fprefetch-loop-arrays -pipe" and
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-Bdirect".
Whole system has been built with these (well, some packages couldn't be built with --as-needed but that's not important here).
My machine is an AMD Athlon64 3200+ with 1 Gig Corsair RAM and a Samsung harddisk that does 60MB/s and has 7200rpm.
The whole system is running very stable and fast. KDE starts up within ten seconds and everything is working well.
Exept for one thing which is however quite essential, I think:
priorities. For instance, when I play my music. I have yammi and XMMS running as root on nice -20, the highest possible priority.
As a normal user, I am surfing the web while listening to music. Then I visit a complicated page with a lot of Javascript, CSS and GIFs in it and it happens: The music hangs. Of course, Firefox needs some seconds of 100% CPU power to render such a site. But playing music takes not even one percent of CPU when the system is idle.
How can it ever happen, that a process which is run by the super user under the highest priority is waiting for a stupid normal-priority user process? Why does the system not reserve this little percent of CPU power for XMMS? Why does the kernel let Firefox write to the harddisk while a nice -20 process wants to read a music file from it? I don't understand this at all. It's just not logical.
I mean, what if my system were a huge server with hundreds of users logged in. Imagine the administrator doing some important things for maintenance that have to be done really quickly or a customer who wants to have something presented. Then they would log in as root and just start their programs on nice -20 and expect them to run flawlessly. Now one of the hundreds of users visits a JavaScript homepage with his little Firefox. The whole server locks up for a millisecond and the presentation for the customer, who is willing to pay a hundred billion dollars if it pleases him, skips. I couldn't imagine anything more embarrasing to Linux.
And it's not just about such "important" things. It starts when I play some music on a party for my friends and I just do anything that could use 100% CPU for a second, I always have to be afraid of skips in the music. And then everyone laughs about linux and says "ouuuh, what an ugly exotic operating system! Can't even do multitasking!!!"
Please help me to get rid of this problem. _________________ gentoo ownz. |
|
Back to top |
|
|
eelke Guru
Joined: 17 May 2004 Posts: 406 Location: Earth, Netherlands, Friesland
|
Posted: Mon Dec 19, 2005 8:43 pm Post subject: |
|
|
Maybe you should try a different kernel. The nitro kernel contains the staircase scheduler which should be an improvement but maybe it doesn't handle this case very well. I know the basic algorithm used by the staircase scheduler and it is very hard to predict what it would do with xmms. Because of the high priority XMMS will startout on the top of the staircase but then it becomes difficult on one side you have that XMMS uses very little cpu time so it should stay on top of the staircase on the other hand it will get scheduled quite often which might cause it to be moved down the staircase (which means down in priority). Firefox is most of the time idle which will cause it to stay at its starting level, which was ofcourse lower but might end up to be higher. |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Mon Dec 19, 2005 9:11 pm Post subject: |
|
|
Doesn't happen to me. But then, I'm using safe cflags. I would recommend changing the cflags and doing a complete recompilation with a desktop kernel config. _________________ Improve your font rendering and ALSA sound |
|
Back to top |
|
|
Ypsilon Tux's lil' helper
Joined: 19 Jul 2002 Posts: 92 Location: Germany
|
Posted: Mon Dec 19, 2005 9:25 pm Post subject: |
|
|
Yes I will try that. I have another partition where I will copy my whole system and recompile it with safe CFLAGS and no LDFLAGS at all. Maybe I'll try vanilla kernel, too. _________________ gentoo ownz. |
|
Back to top |
|
|
mutex Tux's lil' helper
Joined: 04 Sep 2003 Posts: 146
|
Posted: Mon Dec 19, 2005 9:33 pm Post subject: |
|
|
I've noticed a less profound example on my system and I am using safe CFLAGS (-O2 -march=k8 -pipe). I haven't tried to play music yet on it though, but I did notice a similiar drain on the system when I was playing WoW on Cedega w/ it set to nice -20 and and emerge task on nice 19. I just thought it was because Cedega requires so much of the CPU to play WoW, but now that I've seen this I'm beginning to think I have a scheduler issue as well. I'll try playing music tonight. |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Mon Dec 19, 2005 9:34 pm Post subject: |
|
|
For a desktop, other than gentoo-sources I would recommend ck-sources. |
|
Back to top |
|
|
sundialsvc4 Guru
Joined: 10 Nov 2005 Posts: 436
|
Posted: Mon Dec 19, 2005 10:16 pm Post subject: |
|
|
It may be informative to experiment with much-less-pronounced priority boosts.
In other words, what happens if you use (say) nice -3?
The music-task is primarily I/O bound; it simply needs to be very responsive when an interruption does occur. Basically, you're looking for so-called real time scheduling, which Linux does only marginally well.
If you set its priority so extremely high, the result might not be necessarily "better" than a more slight adjustment which works better with the mathematics of a priority-calculation.
Also, if the music process is retrieving information from the disk, and it finds itself competing with a program-load operation against the same disk, the delay might be being caused .. not by processor scheduling, but by I/O scheduling. Even by such mundane things as seek-time on the hard drive (the time it takes to move the little read/write heads around). (See kernel: "drivers/block...") A lot can depend on exactly how the writer of the music-program structured the I/O requests that are being made by his application, and by the scheduling discipline you have seleced for that device. If you have more than one drive and can distribute the I/O load between them, that would be a good thing to do. |
|
Back to top |
|
|
mutex Tux's lil' helper
Joined: 04 Sep 2003 Posts: 146
|
Posted: Tue Dec 20, 2005 5:26 am Post subject: |
|
|
There is definetly something wrong here, this doesn't seem like normal gentoo behavior at all... copying files from one drive to another seems to seriously cause problems w/ scheduling. Even typing in this box is delayed and mouse movements are delayed. Forget about watching videos or playing music. I'm using gentoo-sources kernel 2.6.14-r2 on amd64 w/ a preemptive kernel using 1000 m/s latency and am pre-empting the big kernel lock.
There is another case/thread of a similiar if not same problem here in the amd64 forum:
https://forums.gentoo.org/viewtopic-t-414392.html |
|
Back to top |
|
|
sundialsvc4 Guru
Joined: 10 Nov 2005 Posts: 436
|
Posted: Tue Dec 20, 2005 5:57 pm Post subject: |
|
|
Once again it does not sound like CPU scheduling to me at all ... but a serious I/O configuration problem. It's fairly screaming to me that DMA is not turned on. |
|
Back to top |
|
|
|