Re: [PATCH] deinline sleep/delay functions
From: Denis Vlasenko (vda_at_ilport.com.ua)
Date: 06/30/05
- Previous message: Michael Ellerman: "[PATCH 8/12] iseries_veth: Replace lock-protected atomic with an ordinary variable"
- In reply to: Arjan van de Ven: "Re: [PATCH] deinline sleep/delay functions"
- Next in thread: Arjan van de Ven: "Re: [PATCH] deinline sleep/delay functions"
- Reply: Arjan van de Ven: "Re: [PATCH] deinline sleep/delay functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: Arjan van de Ven <arjan@infradead.org>, Andrew Morton <akpm@osdl.org> Date: Thu, 30 Jun 2005 13:21:20 +0300
On Thursday 30 June 2005 12:19, Arjan van de Ven wrote:
>
> > > There are a number of compile-time checks that your patch has removed
> > > which catch such things, and as such your patch is not acceptable.
> > > Some architectures have a lower threshold of acceptability for the
> > > maximum udelay value, so it's absolutely necessary to keep this.
> >
> > It removes that check from x86 - other architectures retain it.
> >
> > I don't recall seeing anyone trigger the check,
>
> I do ;) Esp in vendor out of tree crap. It's a good compile time
> diagnostic so the junk code doesnt' hit mainline but gets fixed first.
It seems my patch was incomplete.
Thinking more about it, since it exists in all arches
and also since delaying is not performance critical
(hey, if we're going to delay/sleep, we surely can burn
a few more cycles), this can be done as follows:
linux/timer.c:
void ndelay(unsigned int nsecs)
{
unsigned int m = nsecs/(1024*1024);
while (m--)
__ndelay(1024);
__ndelay(nsecs % (1024*1024));
}
void udelay(unsigned int usecs)
{
unsigned int k = usecs/1024;
while (k--)
__udelay(1024);
__udelay(usecs % 1024);
}
void mdelay(unsigned int msecs)
{
while (msecs--)
udelay(1000);
}
void ssleep(unsigned int secs)
{
msleep(secs * 1000);
}
and arches will need to only supply two functions:
__udelay(n) [n is guaranteed <1024]
__ndelay(n) [n is guaranteed <1024*1024]
For users, _any_ value, however large, will work for
any delay function.
Comments?
-- vda - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Michael Ellerman: "[PATCH 8/12] iseries_veth: Replace lock-protected atomic with an ordinary variable"
- In reply to: Arjan van de Ven: "Re: [PATCH] deinline sleep/delay functions"
- Next in thread: Arjan van de Ven: "Re: [PATCH] deinline sleep/delay functions"
- Reply: Arjan van de Ven: "Re: [PATCH] deinline sleep/delay functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|