SRCDS Steam group


[Linux]: Linux 1000fps Kernel Howto
#1
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
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
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)
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
If not, skip.

Lets start the configuration utility:
Code:
make menuconfig
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:

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 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.
Reply
#2
reserved
Reply
#3
will this work with Ubuntu Server?
Jim
CEO
Co-Founder
Veloci Servers
¤ø„¸¨°º¤ø„¸ ¸„ø¤º°¨¸„ø¤º°¨
¨°º¤ø„¸ Hardstyle ¸„ø¤º°¨
¸„ø¤º°¨ Q Dance ``°º¤øFrom Ireland
Reply
#4
i do not see where this path is at in debian.


If it does work and you like the results, edit /etc/grub.conf and set defualt=0
Reply
#5
under Processor family (Hit Enter and choose your processor) --->
I have the option to set processor type to core 2/ newer Zeon which we are using the new quad zeons, but a question?
Has anyone had any issues running srcds under the zeon cpu code?
Reply
#6
ComputerHelper Wrote:will this work with Ubuntu Server?
I remember someone mentioning that you can achieve 1000fps straight out of the box with Ubuntu Server.
Reply
#7
Just thought I'd add this as it is not clear to beginners,

After you open grub and test the new kernel with the following code:

grub
savedefault --default=0 --once
quit

You need to reboot your server in order to test the new kernel.

So run the commands above, then reboot it, if the reboot fails that most likely means the kernel did not work. Then you need to do a manual reboot or power reboot and it will restore the original kernel.

If you're local to the server (not logging in remotely), you'll be able to see what fails, but if you're not local - you won't - it just won't boot.
Reply
#8
I'll try this one tutorial. Thanks a lot!
Reply
#9
Hey thanks, but this only gives my tf2/css servers 333fps :|. What would i need to edit to make it higher?
Reply
#10
This tutorial seems quite old. I have written a new one, see my signature...
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#11
I recommend we lock this thread and sticky BehaartesEtwas' thread (umm.. actually, is there thread here? Maybe there should be so it can be stickied).
Reply
#12
I have tried this way and the http://wiki.fragaholics.de (Linux Kernel HOWTO!) way and all i get is insmod errors!
Reply
#13
Your insmod errors have nothing to do with the fragaholics guide. Make sure you're:
A- copying your current kernel configuration into your build directory as it will alleviate a ton of missed drivers if you're starting from the defaults.

B- make sure you're compiling in the correct modules for your filesystem -- I have found that kernels are finicky with LVM so if you have LVM consider changing it to ext3 or something or moving to a RTK that you know supports LVM. Point in case, the most recent kernel and RTK patch (as of this weekend) does not support LVM. The mapper module that is compiled is the wrong version, will fail to load and will leave you at a panicked kernel.

C- also referencing a guide that is OS-specific. For example, CentOS and Fedora differ slightly in their install process and while BehaartesEtwas' most recent guide mentions the build --rpm step, others highlight that kind of stuff more in depth.

D- You can also try extracting the ramdisk after building it to make sure it has the expected files. After you see the errors on the grub screen enough times, you'll know what you're missing. This is hardly every necessary, I would just make clean the build directory, then rm -r the whole source and build directory and start again -- and then I'd start again with the next newest kernel release -- all before I did this kind of troubleshooting.

E- post a request for help somewhere in a forum that will be constructive, don't flame someone in a random topic because you can't get their (excellent IMHO) guide to work.

Just some starting ideas...
Reply
#14
(10-22-2009, 03:20 PM)jheiv Wrote:  Your insmod errors have nothing to do with the fragaholics guide. Make sure you're:
A- copying your current kernel configuration into your build directory as it will alleviate a ton of missed drivers if you're starting from the defaults.

B- make sure you're compiling in the correct modules for your filesystem -- I have found that kernels are finicky with LVM so if you have LVM consider changing it to ext3 or something or moving to a RTK that you know supports LVM. Point in case, the most recent kernel and RTK patch (as of this weekend) does not support LVM. The mapper module that is compiled is the wrong version, will fail to load and will leave you at a panicked kernel.

C- also referencing a guide that is OS-specific. For example, CentOS and Fedora differ slightly in their install process and while BehaartesEtwas' most recent guide mentions the build --rpm step, others highlight that kind of stuff more in depth.

D- You can also try extracting the ramdisk after building it to make sure it has the expected files. After you see the errors on the grub screen enough times, you'll know what you're missing. This is hardly every necessary, I would just make clean the build directory, then rm -r the whole source and build directory and start again -- and then I'd start again with the next newest kernel release -- all before I did this kind of troubleshooting.

E- post a request for help somewhere in a forum that will be constructive, don't flame someone in a random topic because you can't get their (excellent IMHO) guide to work.

Just some starting ideas...

Sorry i was not flaming!!!. My system is using LVM as i have two Hard Discs using as one. Centos made that partition type upon install.

You can delete the posts i've made as not to make the sticky look messy!
Reply
#15
Everything is here: http://michalsiek.com/csstutorial.html



Keeps 1000 FPS cont.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)