Re: [PATCH] Dynamic tick for x86 version 050602-2

Pavel Machek
2005-06-10T09:15:43Z

Hi!

> > > +#define NS_TICK_LEN ((1 * 1000000000)/HZ)
> > > +#define DYN_TICK_MIN_SKIP 2
> > > +
> > > +#ifdef CONFIG_NO_IDLE_HZ
> > > +
> > > +extern unsigned long dyn_tick_reprogram_timer(void);
> > > +
> > > +#else
> > > +
> > > +#define arch_has_safe_halt() 0
> > > +#define dyn_tick_reprogram_timer() {}
> >
> > do {} while (0)
> >
> > , else you are preparing trap for someone.
>
> Can you please explain what the difference between these two are?
> Some compiler version specific thing?

It took me quite some remembering. Problem is that with your macros,
someone can write

dyn_tick_reprogram_timer()
printk();

[notice missing ; at first line], and still get it compile. If you
replace {} with do {} while (0), he'll get compile error as he should.

> > > Index: linux-dev/kernel/dyn-tick.c
> > > ===================================================================
> > > --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> > > +++ linux-dev/kernel/dyn-tick.c 2005-06-02 10:37:12.000000000 -0700
> > > @@ -0,0 +1,235 @@
> > > +/*
> > > + * linux/arch/i386/kernel/dyn-tick.c
> > > + *
> > > + * Beginnings of generic dynamic tick timer support
> > > + *
> > > + * Copyright (C) 2004 Nokia Corporation
> > > + * Written by Tony Lindgen <tony@atomide.com> and
> > > + * Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
> > > + *
> >
> > Heh, you work for Nokia? Can I get one of those nokia 770 toys? I
> > should have 100 euros somewhere here :-).
>
> Yes, we did dyntick originally for ARM OMAP and 770. I don't think
> I have any power who Nokia will be giving the discount developer
> 770's for though :) I think you have to apply on some webpage...

Thanks for the info (and for the ARM work).
Pavel