public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Periodic clock tick considered harmful (was: Re: HZ, preferably as small  as possible)
@ 2002-07-11 16:44 dank
  2002-07-11 16:59 ` Thunder from the hill
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: dank @ 2002-07-11 16:44 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

Mark Mielke <mark@mark.mielke.cc> wrote:
> 
> On Wed, Jul 10, 2002 at 04:09:21PM -0600, Cort Dougan wrote:
> > Yes, please do make it a config option.  10x interrupt overhead makes me
> > worry.  It lets users tailor the kernel to their expected load.
> 
> All this talk is getting to me.
> 
> I thought we recently (1 month ago? 2 months ago?) concluded that
> increases in interrupt frequency only affects performance by a very
> small amount, but generates an increase in responsiveness. The only
> real argument against that I have seen, is the 'power conservation'
> argument. The idea was, that the scheduler itself did not execute
> on most interrupts. The clock is updated, and that is about all.

On UML and mainframe Linux, *any* periodic clock tick 
is heavy overhead when you have a large number of 
(mostly idle) instances of Linux running, isn't it?   
I think I once heard those architectures went to great lengths 
to avoid periodic clock ticks.  (My memory is rusty, though.)

How about this: let's apply the high-resolution timer patch,
which adds explicit timer events inbetween the normal 100 Hz
events when needed to satisfy precise sleep requests.  Then
let's increase the interval between the normal periodic clock
events from 10ms to infinity.  Everything will keep working,
as the high-resolution timer patch code will schedule timer
events as needed -- but suddenly we'll have power consumption 
as low as possible, snappier performance, and the thousands-of-instances
case will no longer have this huge drain on performance from
periodic timer events that do nothing but update jiffiers.

OK, so I'm just an ignorant member of the peanut gallery, but
I'd like to hear a real kernel hacker explain why this isn't
the way to go.

- Dan

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Periodic clock tick considered harmful (was: Re: HZ, preferably as small as possible)
@ 2002-07-11 21:28 Per Jessen
  0 siblings, 0 replies; 14+ messages in thread
From: Per Jessen @ 2002-07-11 21:28 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

On Thu, 11 Jul 2002 09:44:35 -0700, dank@kegel.com wrote:

>Mark Mielke <mark@mark.mielke.cc> wrote:
>> 
>> On Wed, Jul 10, 2002 at 04:09:21PM -0600, Cort Dougan wrote:
>> > Yes, please do make it a config option.  10x interrupt overhead makes me
>> > worry.  It lets users tailor the kernel to their expected load.
>> 
>> All this talk is getting to me.
>> 
>> I thought we recently (1 month ago? 2 months ago?) concluded that
>> increases in interrupt frequency only affects performance by a very
>> small amount, but generates an increase in responsiveness. The only
>> real argument against that I have seen, is the 'power conservation'
>> argument. The idea was, that the scheduler itself did not execute
>> on most interrupts. The clock is updated, and that is about all.
>
>On UML and mainframe Linux, *any* periodic clock tick 
>is heavy overhead when you have a large number of 
>(mostly idle) instances of Linux running, isn't it?   

Without knowing what UML is in this context, but assuming that mainframe
means IBM s390 mainframes, I can confirm that any periodic clock tick
is heavy overhead. With or without (mostly) idle instances. 

/Per



regards,
Per Jessen, Zurich
http://www.enidan.com - home of the J1 serial console.

Windows 2001: "I'm sorry Dave ...  I'm afraid I can't do that."



^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Periodic clock tick considered harmful (was: Re: HZ, preferably as small as possible)
@ 2002-07-16  9:10 Martin Schwidefsky
  0 siblings, 0 replies; 14+ messages in thread
From: Martin Schwidefsky @ 2002-07-16  9:10 UTC (permalink / raw)
  To: linux-kernel

>We have a Linux kernel (2.4.18-rmk2) running on the IBM Linux Watch which
>skips timer ticks, but only when there's no work to be done. We have dubbed
>this timing scheme the Work Dependent Timing scheme.  Briefly, on every
>return to the "Linux idle loop", the kernel checks if there's more work to
>be done by parsing relevant lists and queues. If there's no current work to
>be done, nor any work to be done in the next timer tick, the software timer
>with the nearest timeout is retrieved and a hardware timer is programmed
>accordingly with the nearest timeout to wake up the system in time to service
>the associated software timer.

In principle that is what the version 2 of the s/390 timer patch does. My
timer patch is a bit more complicated since it has to cope with an SMP system
but that are just details in the backend code that deal with the question
which cpu is doing the calls to do_timer(). The idea is to stop the hz timer
for every cpu going idle. The last cpu going idle has to check if something is
on tq_timer. If there is work on tq_timer then the clock is not reprogrammed
and the next hz tick comes in normally. If there is nothing on tq_timer
then the next timer event is calculated from the tv1-tv5 arrays and the
clock comparator is reprogrammed. With that all cpus are truly doing nothing
until either the clock comparator or another hardware interrupt comes in.
That is where the monitor call instruction on s/390 comes into play. This neat
instruction either causes a program check or does nothing (a nop). This is
controlled by a bit in control register 8. So the additional cost on the
system entry path is just one cycle for the nop if a cpu is running normally.
The amount of additional work on the system entry path was the main backdraw
of version 1 of the timer patch.

Version 1 of the s/390 timer patch is even more radical. It eliminates the hz
timer completly. Timer events are done with the clock comparator and process
related timer (time slice, itimer and profiling timer) are done with the cpu
timer. Since there isn't a periodic check anymore every change related to
timers has to be notified to the architecture backend. That makes it necessary
to introduce two hooks timer_notify and itimer_notify that are called from
common code. Not really nice but necessary for this approach. A second, more
severe backdraw is the need to check on every system entry if a jiffy update
needs to be done and to do the calculations for proper process time accounting
(in fact the jiffy variable is replaced by a macro and is not a problem but
the wall_time and other internal timing stuff have to get updated).
This makes up for about 60 cycles in the system entry path. This shows up on
some micro benchmarks and was the reason to do version 2.

blue skies,
   Martin

P.S. the two timer patches are available on developer works:
http://www10.software.ibm.com/developerworks/opensource/linux390/current2_4_17.shtml#jun132002-timer
http://www10.software.ibm.com/developerworks/opensource/linux390/current2_4_17-may2002.shtml#timer20020531

Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Schönaicherstr. 220, D-71032 Böblingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: schwidefsky@de.ibm.com


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2002-07-16  9:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-11 16:44 Periodic clock tick considered harmful (was: Re: HZ, preferably as small as possible) dank
2002-07-11 16:59 ` Thunder from the hill
2002-07-11 19:45   ` Arnd Bergmann
2002-07-11 17:05     ` Hubertus Franke
2002-07-11 19:06 ` george anzinger
2002-07-11 19:19   ` mbs
2002-07-11 20:25     ` george anzinger
2002-07-11 21:29       ` Periodic clock tick considered harmful (was: Re: HZ, preferably as Alan Cox
2002-07-11 21:43         ` george anzinger
2002-07-11 22:32       ` Periodic clock tick considered harmful (was: Re: HZ, preferably as small as possible) Karim Yaghmour
2002-07-15  5:21 ` Linus Torvalds
2002-07-15  5:43   ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2002-07-11 21:28 Per Jessen
2002-07-16  9:10 Martin Schwidefsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox