Re: [PATCH v4] introduce macro spin_event_timeout()

From: Timur Tabi
Date: Tue Mar 10 2009 - 15:05:46 EST


Grant Likely wrote:

> I typically use something in the form of this pattern on powerpc code
> when I absolutely have to busywait.
> int end_ts = get_tbl() + some_delay; /* note that this is signed */
> while (end_ts - get_tbl() > 0)
> if (condition)
> break;

Funny you mention this, because I was just about to implement the same
thing. Of course, it will be a PowerPC-only function, but I suppose
that's its fate regardless.

> This macro also looks like a tempting unbounded latency tarpit to fall
> into when people start using it in critical regions, but that goes
> for code using a non-timed-out busywait also.

I can't fix everything!

--
Timur Tabi
Linux kernel developer at Freescale
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/