Performance enhancements

Marvin P. Dickens mpdickens
Mon May 17 11:42:17 PDT 2004


A couple of performance enhancements that I use:



(1) DISABLING SWAP SPACE

Many programs run best without a swap space. With memory sizes increasing and hard drives still rotating at the same rate they were spinning in 1998, swap spaces are pointless (If you have the RAM... ). The question then is how to make Linux run without a swap space since all distributions like to install them by default. (It's funny.... I remember when the caldera disto installed a swap, but did not activate it... The user community went nuts) Theoretically you should be able to do:

swapoff -a

Unfortunately, without a swap space, the  kswapd (a tasklet) normally runs at 100%. To eliminate this system stopper, edit linux/mm/vmscan.c. In this file, put a line that says return 0; before it says:

	/*
	 * Kswapd main loop.
	 */

Then recompile the kernel. As a side note, I know alot of people do not want to run a system without a swap space. However, If you've got more than 750MB of ram in your system the chances are you're never gonna use a swap space.


(2.) ENLARGING SOUND BUFFERS

In order to improve realtime performance as related to sound, the audio buffers for all the Linux sound drivers were reduced from 127k to 64k. For recording audio or video (Or both at the same time as in a movie or home video) this causes dropouts. A kernel hack is in order.
This hack is only applicable to the OSS version of the Soundblaster Live driver. Since every sound card and every sound driver has a different implementation of buffer schemes, you'll need to do some hunting around in the .c and .h source code files that relate to other sound cards. But, even with other cards, if you look, you'll find it. Anyway, for the Soundblaster live driver go to the file: 

linux/drivers/sound/emu10k1/audio.c


Where is says


if (bufsize >= 0x10000)

change it to 

if (bufsize > 0x40000)

In linux/drivers/sound/emu10k1/hwaccess.h

Change

#define MAXBUFSIZE 65536

to

#define MAXBUFSIZE 262144

Finally, in linux/drivers/sound/emu10k1/cardwi.h

#define WAVEIN_MAXBUFSIZE 65536

to

#define WAVEIN_MAXBUFSIZE 262144

Then recompile the kernel modules.



(3.) MAKING XFree86 FASTER

XFree86 can't display pixmap rendering very fast. The X server stalls during list box drawing as well as during the rendering of other widgets. Fix this by adding a line to your XF86Config* file:

In the Section "Device" area, add a line saying:

Option "XaaNoOffscreenPixmaps"

and restart the X server.

(4.) FREEING MORE MEMORY

The Linux kernel only allows for 32MB of shared memory to be allocated (by default). Considering the price of hardware today, specically RAM, this is insane and needs to be increased to do anything useful. Run the following command:

echo "0x7fffffff" > /proc/sys/kernel/shmmax 

Please note that 0x7fffffff is about 214mb. Please adjust this value to reflect your system and your needs.


All of the above works for me. However, as usual, you do the above at your own risk.



Best

Peck


More information about the Linux-users mailing list