2006-09-16 23:19:32

by John Richard Moser

[permalink] [raw]
Subject: Scheduler tunables?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It looks like the scheduler tunables have been removed from 2.6
somewhere before 2.6.17. I'm looking at these because I am considering
increasing the minimum timeslice to at least 80msec.

I'm considering also either a geometric or algebraic transform (multiply
or add) to timeslices, letting them get calculated as-is but then
applying the transformation after the base timeslice size is figured
out. The reason for this is to try and tweak certain embedded systems
which seem to suffer from CPU cache issues... low L1 cache, cache isn't
stored/restored across task switches like registers (that would be
dumb...), and a cache miss costs 25 cycles while a cache hit costs 1.

I took a look at this in cachegrind (profile is I1 and D1 are both 16384
byte 4-way set associative with 32-byte cache lines; there is no L2
cache, feed it 64,2,32 and ignore the stats for I2/D2) and came up with
something like a 44.5% performance hit if we assume that context
switches and multitasking never happen based ONLY on the D1 stats (1.9%
D1 cache miss). For comparision, my Athlon 64 misses 0.9% of the time
but only misses L2 cache 0.2% of the time and would suffer a 5%
performance hit from this (assuming L2 cache takes 1 extra cycle and an
L2 cache miss takes 25 extra).

My worry is that 44.5% is based on idiotic assumptions, namely that the
process is never scheduled away from, not for interrupts or multitasking
or syscalls. When scheduling or syscalls happens, the cache will start
to have entries replaced by entries in other tasks; by the time we come
back to the current task, we'll have a few areas of the working set no
longer cached, and get more cache misses. The only thing I can do for
this is prevent scheduling as long as is feasible.

If anyone wants to correct me on anything I've gotten wrong here feel
free, I'm still digging around looking for ways to improve the
situation. Reducing code executed is a good way (i.e. make programs not
do a lot of excess junk), but is case by case; finding a way to knock
out even 5% of the overhead here globally would be helpful.

- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

Creative brains are a valuable, limited resource. They shouldn't be
wasted on re-inventing the wheel when there are so many fascinating
new problems waiting out there.
-- Eric Steven Raymond

We will enslave their women, eat their children and rape their
cattle!
-- Bosc, Evil alien overlord from the fifth dimension
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBRQyGfgs1xW0HCTEFAQLTxw//cWJ2Ep473TqC9KmuiM1Lr189gKs9sfgk
Aacrt10nSGBlLmjH6dR51By8kpjGasMH3Wr4l2/TdeMhWx+ME+uWM8jYTclX5Cei
LcJamzCoMQGmqFvDe4iGbh66zFhUnJFX+UhQ2zvPhAd1RVBad1sCvb8YJC5M892d
abSBPWO3FmP2JsDdfcq82Th0kxi7xHfib3QBMoVD+3nRiAgOCMkXle7yb3G7M375
j2F7etKqDnd1Iv0Rm7VuWvG/gA8hoMtgYR5q/sibZGAk3BwPCNTg1T0D/LSIKoat
v+5monnYUMN2X491zF0JPONqTh0KtpBURGfWPQ59OODkVBcJQqPelHsZXuUBzdGz
STyNIvCKMZkjFDJ7VMxopfxneG76DEbyd9MlllNhWqbLT5OREJZm62MOWP1nfInT
/LkuyOe5GvEtPTy1DT13upSkxAppPfpqmkNwOXAlgrEuriTp6mOep32v+/XoWoFB
oYSATThDN7vaZFbw3V5+wQFbaA7uzAzfyvptXstFhDtM9791WoRZWRJArqQJnCcr
nayqJvEH/H4oOhtFIwCpICOu1upcuN6s34R7ROZ+5OpajduXRa/ejIEaW3TEecyY
nteQLmy+gYvzISOf8ynK3JV5tEcSOS8uNWJFX9dSsw2/HK0GDJCpMNDFrCbZi6ou
JgytxT3qAiE=
=K8DM
-----END PGP SIGNATURE-----


2006-09-17 06:52:43

by Mike Galbraith

[permalink] [raw]
Subject: Re: Scheduler tunables?

On Sat, 2006-09-16 at 19:19 -0400, John Richard Moser wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> It looks like the scheduler tunables have been removed from 2.6
> somewhere before 2.6.17.

Which tunables are you referring to?

2006-09-17 15:19:38

by John Richard Moser

[permalink] [raw]
Subject: Re: Scheduler tunables?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Mike Galbraith wrote:
> On Sat, 2006-09-16 at 19:19 -0400, John Richard Moser wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> It looks like the scheduler tunables have been removed from 2.6
>> somewhere before 2.6.17.
>
> Which tunables are you referring to?
>
>

http://kerneltrap.org/node/525

The relevant code changes in sysctl.h and sched.c seem to be undone. Of
course I'm assuming my distribution didn't just add a side patch in at
the time when I noticed these existed so long ago.

- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

Creative brains are a valuable, limited resource. They shouldn't be
wasted on re-inventing the wheel when there are so many fascinating
new problems waiting out there.
-- Eric Steven Raymond

We will enslave their women, eat their children and rape their
cattle!
-- Bosc, Evil alien overlord from the fifth dimension
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBRQ1nhAs1xW0HCTEFAQJ9ow/9FJGsdk/7QT6oQxZpvHgyu7x25VBN94EG
AVEP8LUGY8YHj51wRlJiBz03gBAukoW6ZHFjgSKhria/4L4pA1XluOvU9zA/1epk
MXi9m84NiL7Jxf1tWadD/APuXGpGoyhDWbMC5CDZWv8Pm6ypQz4hyEQfxHKJSVke
v09RnO1OHneJQgmOEC8zBnP7900uu+xFcoNjY+fgUi58QS18vWrySTrnrRlfTXSC
8SULfavvsnAL5ErSzC9pyhCREl8XKsyX8LrbK7Je8hRnuhwnNdFN2TZSIKqG+kLQ
aMYj+Dadqw4QivBjipgwSQ7rTcawBPZzkR6qIeITZ6SyNg10PGn9Bj+D1eiFpCU6
0tUEfdhefWToXMMTYFyGr8yZP13UzPg6ND1NWwTeuEflObTlkwXEc2zIkn0EzjEK
ETxQRq7E7v2L+eGxnddf6kPQl69BtrCfwkpapJ6YK8dV0eeRLsncvDd2XYr4/000
aUsoh3dTqnV0s2TW4rnzRTmgTE0/U5tNsFAoVeYRKxfTGzdTE2dRrGIXyGjW+C2D
YBLEzdkq20UMVfjGLSw0vHdr14wjnCFQwM9kK1RSgOKi31J/AHfI0bPIL4Em1a87
8KLOV5Fk/Ri+s2+sJOSf6WE6TAkrjS+CnYm40FuROvzyKCCmNj7gMl4DDtxzvjUi
oD/Li5Yn5Bw=
=qLt2
-----END PGP SIGNATURE-----

2006-09-17 17:07:38

by Mike Galbraith

[permalink] [raw]
Subject: Re: Scheduler tunables?

On Sun, 2006-09-17 at 11:19 -0400, John Richard Moser wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>
> Mike Galbraith wrote:
> > On Sat, 2006-09-16 at 19:19 -0400, John Richard Moser wrote:
> >> -----BEGIN PGP SIGNED MESSAGE-----
> >> Hash: SHA1
> >>
> >> It looks like the scheduler tunables have been removed from 2.6
> >> somewhere before 2.6.17.
> >
> > Which tunables are you referring to?
> >
> >
>
> http://kerneltrap.org/node/525
>
> The relevant code changes in sysctl.h and sched.c seem to be undone. Of
> course I'm assuming my distribution didn't just add a side patch in at
> the time when I noticed these existed so long ago.

Ah. These knobs were never exported in a standard kernel. I believe
there was a patch recently (couple weeks ago?) posted to export them
again for experimentation. A search of the archives should turn it up.

-Mike

2006-09-17 18:47:17

by John Richard Moser

[permalink] [raw]
Subject: Re: Scheduler tunables?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Mike Galbraith wrote:
> On Sun, 2006-09-17 at 11:19 -0400, John Richard Moser wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>>
>>
>> Mike Galbraith wrote:
>>> On Sat, 2006-09-16 at 19:19 -0400, John Richard Moser wrote:
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> It looks like the scheduler tunables have been removed from 2.6
>>>> somewhere before 2.6.17.
>>> Which tunables are you referring to?
>>>
>>>
>> http://kerneltrap.org/node/525
>>
>> The relevant code changes in sysctl.h and sched.c seem to be undone. Of
>> course I'm assuming my distribution didn't just add a side patch in at
>> the time when I noticed these existed so long ago.
>
> Ah. These knobs were never exported in a standard kernel. I believe
> there was a patch recently (couple weeks ago?) posted to export them
> again for experimentation. A search of the archives should turn it up.
>

Nods. May be good in environments where longer time slices could be a
significant performance enhancement.


> -Mike
>
>

- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

Creative brains are a valuable, limited resource. They shouldn't be
wasted on re-inventing the wheel when there are so many fascinating
new problems waiting out there.
-- Eric Steven Raymond

We will enslave their women, eat their children and rape their
cattle!
-- Bosc, Evil alien overlord from the fifth dimension
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBRQ2YLgs1xW0HCTEFAQJO8hAAm/ycdiOe4oEY0kUwf6irUj9FHQ/zOhJe
jLIvBqE60GnyP7Ry8Xk1vA9CM009xrbY2uYPyFmlSaiydPqkaganaCkAIS3deg1z
EIT85MQCY6YHkUxOnjNScIkylSjr0jy3aDQtz0aNU1TAbnyYPwZyAAKU1N3ouwMG
M0PPZqQTUiRM6IKbNgFENpx83VopovFmBLtWRXFGj4n6dPx1SjB7gSRbUlJ4oKNl
4wHb06uZgV4pCJaKJv3h8yLmtepVleRMVA4QwIvTql4UizaX8XQt6hfhxtpoIAbD
fBDZ/wtD4rqUiMFiB9Y0nb2OQmQLS1bWwfXjXU/ZsJdz+zSe1qC3TLfwkL4Sjhxo
cC8HjOJyjo1vU0GT/Pq11JY2jvbbPlkbmk8VTV7g7+E602wfg+BLjcmKlN6scl6T
rkCy824HFnxCXlldvHXqxq2My/Ys7HQFK92QuMdRrQF3AkPKKtLwAEJHZh+hW1oB
N15XFXXN6SgP69UiRGBo6+QyZHTjmHlw+nNgBBBFrRwvr10NYVCV/el+e7eGY8hC
YWy+wIqMEN51F6NEPsdSUg0od94mlc6waER6gMgxnFZMVR4TzTfKtDogqW28dRSp
AoaXY7TynFt2K1d3iOlk7OtiX9R+U1WxDrAeNlPm/meeJjbSD8ClsqhNPbzunO0E
/GeJOByK/o8=
=zYrn
-----END PGP SIGNATURE-----