At 05:10 PM 4/28/2009, Kveri wrote:
>Hello,
>
>I have some new info about 1000fps servers that we were discussing in
>November 2008.
>
>Old topic is here:
>http://list.valvesoftware.com/mailman/private/hlds_linux/2008-November/058527.html
>
>So, I was able to get constant 1000fps server, by constant I mean no
>drops, not single one (sorry for arguing too much in November, I was wrong).
>
>But there are some issues I encountered.
>
>1. I think htop, top and others are not showing CPU usage correct. 0% of
>all cores when 10 fully loaded 12 player 1000fps servers with pingboost
>3, it's funny.

Because you butchered the kernel timecounter code with fictitious 
values. No matter
what runs on the machine, you will now never get accurate usage values.


>2. segfaults, sometimes it just hangs. I don't know why, debug says
>nothing, but I was able to minimize if not eliminate those segfaults
>(but I don't know how, yet).

Another side effect of the above. It could also be because your 
system clock is drifting backwards due
to you altering SHIFT_HZ.

>I'm using Gentoo 64bit, but it should be almost same for any other Linux
>disto.
>
>Here is the kernel config: http://kveri.com/1000fps_kernel_config
>
>If you're willing to try it, I'll be glad.
>
>First of all: it's vanilla kernel 2.6.26.8 (kernel.org)
>NO RT patch
>just this config and these few steps:
>
>include/asm/param.h (or any other param.h under include dir in kernel root):
>
>#ifdef __KERNEL__
># define HZ             2100            /* Internal kernel timer
>frequency */
># define USER_HZ        1               /* some user interfaces are */
># define CLOCKS_PER_SEC 1              /* in "ticks" like times() */
>#endif

USER_HZ always runs at usually whatever HZ is, IIRC. Or maybe it's 
whatever the PIT is running at.

>include/linux/jiffies.h:
>change
>#elif HZ >= 1536 && HZ < 3072
># define SHIFT_HZ       11
>
>to
>#elif HZ >= 1536 && HZ < 3072
># define SHIFT_HZ       1

Changing Shift_HZ to 1 is evil, and breaks everything else including 
ntp and adjtimex.

>and
>
>change
># define LATCH ((CLOCK_TICK_RATE + HZ / 2) / HZ) / * For divider * /
>
>to
>#define LATCH  ((CLOCK_TICK_RATE + 2200/2) / 2200)      /* For divider */
>
>kernel/timeconst.pl:
>change (comment it)
>print "#if HZ != $hz\n";
>print "#error \"kernel/timeconst.h has the wrong HZ value!\"\n";
>print "#endif\n";
>
>to
>#       print "#if HZ != $hz\n";
>#       print "#error \"kernel/timeconst.h has the wrong HZ value!\"\n";
>#       print "#endif\n";
>
>and execute:
>kernel/timeconst.pl 2100 > kernel/timeconst.h
>
>*this step is probably why my CPU stats aren't working correctly anymore*.

>Next, use TSC clocksource,
>
>for grub: add clocksource="tsc" to your kernel command line in
>menu.lst/grub.conf
>
>for lilo: add append="clocksource=TSC" to your /etc/lilo.conf, under
>this kernel image and execute /sbin/lilo.

TSC is better to read, but use HPET if you can.

>I didn't try hpet, but it probably worth trying, as well as changing CPU
>I/O schedulers in kernel.

There are no such things are CPU I/O Schedulers. You are talking 
about disk I/O schedulers.

>That config I posted above is heavily optimized for my hardware, but it
>can be optimized further, make sure it suits your hardware.

I wouldn't suggest it's optimized for your hardware, it's a generic 
config that is altered.

>My experiences: with RT patch I was able to get around 900 fps, but not
>as stable as without RT patch. I tried 4 different kernels (all
>2.6.26.8): 1. without RT without HZ modification, without RT with HZ,
>with RT without HZ and with RT with HZ. Best one was without RT with HZ
>(that one I was discribing).

RT patches are better due to the fact they reduce kernel latency. 
Personally, RT patches are far superior for things like precise 
nanosleep()/tsleep()/usleep()

>Pingboost: I tried anything from pingboost 0 (no -pingboost) to
>pingboost 3, nothing except pingboost 3 gave me 1000fps constant.

Pingboost 1/2 use either an alarm() or select(). Alarm() and Select() 
do NOT use hrtimers, therefor that is why
you are not seeing the behavior you think you are seeing. Select() 
uses jiffies as a clocksource, and jiffies provides very coarse 
resolution, about
the same as the interrupt timer.

>Sys_ticrate:
>well, it looks like anything more than HZ in kernel (2100) makes game
>accelerated, so I'm using sys_ticrate 2000 for now.



>If anyone tries this method/config please let me know what are your
>results, I'll be very interested.
>
>That HZ guide was from: http://www.howto-cs16-root.de/gen_kernel.htm
>some other tips:
>http://wiki.fragaholics.de/index.php/EN:Linux_Kernel_Optimization

Running 2100 interrupts a second does nothing but cause cacheline 
pingpongs due to excessive clock interrupts. IIRC, linux
stops updating syscalls like gtod if HZ >= 1024, so 2100 is useless.




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

Reply via email to