July 23

smp kernels

I had noticed that my new desktop never really used 100% of the CPU, this bothers me for a couple of reasons, first off, if I am doing something CPU intensive like compiling bzflag, then please use all of the CPU, that's what it is there for. If there are other apps running, let the kernel decide how much you get.

Secondly, if you don't use as many cycles as you can get, building takes much much longer. Bzflag used to take, on my old desktop, about 6 mins to compile, now on the new desktop it was taking 20-30 mins. Yuck. This blog now takes about a half hour to build which is ridiculously long. So I headed to #linux on irc.arstechnica.com to investigate. At first the new 4GB of ram was thought to be a culprit but removing a stick had no effect. The command dd if=/dev/urandom | bzip2 > /dev/null was used as a pseudo benchmark, this command should spin up the CPU to 100% right away but mine would sit there at 50% or so. Next I turned off hyper-threading in the bios. This seemed to work, when I rebooted I reran the benchmark and got 100% CPU usage right away. Problem solved I thought. However with HT turned off the system was very poor at multitasking, compiling something and then checking irc or email was a chore as now my terminals kept refreshing all the time.

Next up was to check the kernel, I had installed a stock debian kernel, linux-image-2.6.17-1-686, but didn't realize it came with SMP enabled. I decided to try compiling a new kernel the Debian Way™ so I installed fakeroot debhelper modutils kernel-package libncurses5-dev and then I did make menuconfig and removed the SMP support and followed that with make-kpkg clean and finally to actually build the kernel, sudo fakeroot make-kpkg --append_to_version -686 --initrd --revision=rev. 01 kernel_image and got a cup of tea, while I anxiously waited. The Debian Way™ is pretty nifty as it builds a .deb that is easily installed and makes a ramdisk and updates grub all in one shot, and can be removed like any other package. After rebooting I rebuilt bzflag in 4 mins, a considerable improvement. I thought I solved the problem but I had tested things by recompiling bzflag without doing a make clean so after a fresh checkout it took 40 minutes to build :( I don't know what the next move will be now, more poking around in the kernel I suppose.

(PS thank you Sophmore and johnf in #linux for the help)

(PPS building kernel's the Debian way.)

UPDATE: This morning I reverted to a 2.6.15 kernel but had the same results which led me to believe it might not even be kernel related at all, so on a hunch I removed 2 sticks of RAM and rebooted into the 2.6.17 kernel and everything was zippy and fast again. So it looks life 2GB of ram is the life for me. I can use the other 2GB elsewhere I suppose but its a shame it doesn't work with 4GB.

Posted by æc♥ | Permanent Link