tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Make condition variables take absolute wakeup time



On Wed, May 07, 2008 at 09:59:18AM -0500, David Young wrote:
> On Wed, May 07, 2008 at 02:39:00PM +0100, Andrew Doran wrote:
> > This is for PR kern/38554. I have compiled it but not tested it yet.
> > Also, it doesn't handle kpause() but should. Any comments?
> > 
> > http://www.netbsd.org/~ad/condvar.diff
> 
> In the patch, sometimes cv_timedwait(,, x * hz) becomes cv_timedwait(,,
> cv_time_sec(x)), but sometimes it becomes cv_timedwait(,,
> cv_time_ticks(x)), as it does in dev/acpi/acpi_ec.c.

Yes, that's an error. I haven't reviewd the mechanical changes yet.
 
> In dev/pad/pad.c, hz/100 becomes cv_time_tick(1), which is not the same
> value if hz != 100.

Unlikely to make a difference, but I will change it.

> These days, does hz >> 2 ever generate better code than hz / 4?
> The latter may better express the programmer's intent, if it is "wait
> one quarter of a second."

hz/4 doesn't safely convert for signed quantities, at least on Intel.
I don't know what gcc does.

Andrew


Home | Main Index | Thread Index | Old Index