09-23-2008, 02:16 PM
Lots of people have asked me for help on doing a 1000fps kernel. I figured I'd rewrite this to try and make it as straight forward as possible. I am copy-pasting a lot of it but rewriting some of it to make it more friendly to the first timers. I will post my own version later.
First off, I provide no warranty or guarantees with this howto. This is strickly do at your own risk. A bad kernel can prevent the system from rebooting. Though persuasions are taken in this howto, it is still very risky to do this remotely over the internet. Until you think you can do a recompile in your sleep, I don't recommend trying this without physical access to the machine.
This is a rewrite of the thread found here:
http://forums.steampowered.com/forums/showthread.php?t=486424
This is for redhat/fedora/centos based distributions. If you are looking for Debian, the commands for Debian are found at the above link.
Platform/CPU recommendations:
Core2Quad
Xeon dual/quade core (non-Pentium 4 based)
Opteron 2000/8000 series
Login as root and lets get started:
First off lets cd into the proper directory
and download the kernel package:
Extract our kernel package:
Change directory into the kernel
Now what we are going to do is copy your current kernels configuration file
This will tell you what kernel version your are currently running
This is where autocomplete comes in very handy. if you want more information on how automplete works in bash go here: http://www.lesbell.com.au/Home.nsf/b8ec57204f60dfcb4a2568c60014ed0f/355166f5bfa721afca256da0000a30f4?OpenDocument
and check out "Command, Filename and Hostname Completion"
Now we are going to copy your current kernel configuration into your new kernel.
type
then press tab twice. This will show a list of all files that start with "con" in /boot/
pick the one that matches your uname -r and finish up the line. Add the .config after your selection. (.config as the destination)
Fun, yea?
No we get to the configuring
If this is a recompile,
Do a
If not, skip.
Lets start the configuration utility:
if this doesnt pop up a nice wizard, you will need to install ncurses-devel and ncurses.
Now we are inside menuconfig wizard change these settings:
Processor type and features --->
NO Tickless System (Dynamic Ticks)
YES High Resolution Timer Support
Processor family (Hit Enter and choose your processor) --->
Preemption Model (Hit Enter and choose: Preemptible Kernel (Low-Latency Desktop))
Timer frequency (Hit enter and choose: 1000 HZ) --->
Power management options (ACPI, APM) --->
Disable everything except ACPI
ACPI (Advanced Configuration and Power Interface) Support
YES ACPI Support
CPU Frequency scaling ---> OFF
Now go through and make sure all the drivers you need are turned on, and get rid of anything that you for sure will not need: Sound, modems, etc. Dont turn off anything if you arent sure about, and also make sure that the drivers for your network card and your hard drive controller are ON. those are the two I've most commonly had issues with.
After your all done goto exit and say yes you want to save.
Now we have to edit two files.
First off, lets edit include/linux/jiffies.h
scroll down and find this section:
and change it to this:
basically adding the 11th statement. Save that
Next we want to edit include/asm-<distro>/param.h
where distro is your architecture type, basically asm-x86_64 for 64bit or asm-i386 for 32bit.
At the top of the file you will find this section
Change the USER_HZ from 100 to 1500 and only that:
Save it. And thats it.
Now run these commands to compile and install your new kernel.
Do NOT change the grub.conf in /etc yet to default 0.
In order for you to test it..
Do
If it fails for whatever reason, a restart of the machine will bring up your old kernel.
If it does work and you like the results, edit /etc/grub.conf and set defualt=0
That's about it, pretty sure i got everything. If you see any errors or typos, let me know and I will clean it up.
First off, I provide no warranty or guarantees with this howto. This is strickly do at your own risk. A bad kernel can prevent the system from rebooting. Though persuasions are taken in this howto, it is still very risky to do this remotely over the internet. Until you think you can do a recompile in your sleep, I don't recommend trying this without physical access to the machine.
This is a rewrite of the thread found here:
http://forums.steampowered.com/forums/showthread.php?t=486424
This is for redhat/fedora/centos based distributions. If you are looking for Debian, the commands for Debian are found at the above link.
Platform/CPU recommendations:
Core2Quad
Xeon dual/quade core (non-Pentium 4 based)
Opteron 2000/8000 series
Login as root and lets get started:
First off lets cd into the proper directory
Code:
cd /usr/src/
and download the kernel package:
Code:
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.tar.gz
Extract our kernel package:
Code:
tar xfz linux-2.6.22.tar.gz
Change directory into the kernel
Code:
cd linux-linux-2.6.22
Now what we are going to do is copy your current kernels configuration file
This will tell you what kernel version your are currently running
Code:
uname -r
This is where autocomplete comes in very handy. if you want more information on how automplete works in bash go here: http://www.lesbell.com.au/Home.nsf/b8ec57204f60dfcb4a2568c60014ed0f/355166f5bfa721afca256da0000a30f4?OpenDocument
and check out "Command, Filename and Hostname Completion"
Now we are going to copy your current kernel configuration into your new kernel.
type
Code:
cp -R /boot/con
pick the one that matches your uname -r and finish up the line. Add the .config after your selection. (.config as the destination)
Code:
cp -R /boot/config-2.6.9-42.0.8.ELsmp .config
Fun, yea?
No we get to the configuring
If this is a recompile,
Do a
Code:
make clean
Lets start the configuration utility:
Code:
make menuconfig
Now we are inside menuconfig wizard change these settings:
Processor type and features --->
NO Tickless System (Dynamic Ticks)
YES High Resolution Timer Support
Processor family (Hit Enter and choose your processor) --->
Preemption Model (Hit Enter and choose: Preemptible Kernel (Low-Latency Desktop))
Timer frequency (Hit enter and choose: 1000 HZ) --->
Power management options (ACPI, APM) --->
Disable everything except ACPI
ACPI (Advanced Configuration and Power Interface) Support
YES ACPI Support
CPU Frequency scaling ---> OFF
Now go through and make sure all the drivers you need are turned on, and get rid of anything that you for sure will not need: Sound, modems, etc. Dont turn off anything if you arent sure about, and also make sure that the drivers for your network card and your hard drive controller are ON. those are the two I've most commonly had issues with.
After your all done goto exit and say yes you want to save.
Now we have to edit two files.
First off, lets edit include/linux/jiffies.h
scroll down and find this section:
Code:
#elif HZ >= 384 && HZ < 768
# define SHIFT_HZ 9
#elif HZ >= 768 && HZ < 1536
# define SHIFT_HZ 10
#else
# error You lose.
#endif
and change it to this:
Code:
#elif HZ >= 384 && HZ < 768
# define SHIFT_HZ 9
#elif HZ >= 768 && HZ < 1536
# define SHIFT_HZ 10
#elif HZ >= 1536 && HZ < 3072
# define SHIFT_HZ 11
#else
# error You lose.
#endif
basically adding the 11th statement. Save that
Next we want to edit include/asm-<distro>/param.h
where distro is your architecture type, basically asm-x86_64 for 64bit or asm-i386 for 32bit.
At the top of the file you will find this section
Code:
#ifdef __KERNEL__
# define HZ CONFIG_HZ /* Internal kernel timer frequency */
# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
#endif
Change the USER_HZ from 100 to 1500 and only that:
Code:
#ifdef __KERNEL__
# define HZ CONFIG_HZ /* Internal kernel timer frequency */
# define USER_HZ 1500 /* .. some user interfaces are in "ticks" */
# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
#endif
Save it. And thats it.
Now run these commands to compile and install your new kernel.
Code:
make bzImage
make modules
make modules_install
make install
Do NOT change the grub.conf in /etc yet to default 0.
In order for you to test it..
Do
Code:
grub
savedefault --default=0 --once
quit
If it does work and you like the results, edit /etc/grub.conf and set defualt=0
That's about it, pretty sure i got everything. If you see any errors or typos, let me know and I will clean it up.