Re: Linus 2.6.23-rc1

Linus Torvalds
2007-07-28T21:34:27Z

On Sat, 28 Jul 2007, Linus Torvalds wrote:
>
> Yes, it's what "/proc/sys/kernel/sched_granularity_ns" is supposed to
> tweak, but maybe there's some misfeature there, or maybe the default is
> just bad for games, or whatever.
>
> Ingo: that sysctl_sched_granularity initialization doesn't make sense. You
> talk about it being in units of nanoseconds, but then you do
>
> 2000000000ULL/HZ
>
> which is nonsensical.

Btw, people who actually have 3D games installed (I have exactly one:
ppracer, and I can't really say that I care about how it feels), if you
don't have CONFIG_HZ=1000, this really is worth testing.

I think Ingo probably ran with CONFIG_NO_HZ and HZ_1000, but the default
timer tick is actually 250Hz, which makes all the default scheduler values
come out four times bigger than they are documented/supposed to be.

On SMP, that scheduler granularity then gets doubled once more if you have
two CPU's, so rather than 2ms by default, it ends up being 16ns (and the
time slices themselves end up being bigger than that).

So doing some testing with a simple

echo 2000000 > /proc/sys/kernel/sched_granularity_ns
echo 1000000 > /proc/sys/kernel/sched_batch_wakeup_granularity_ns
echo 8000000 > /proc/sys/kernel/sched_runtime_limit_ns

might be worth doing (and if you vary numbers to see if it matters,
please do let people know!)

Linus