netdev
[Top] [All Lists]

Re: Route cache performance under stress

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: Re: Route cache performance under stress
From: Andi Kleen <ak@xxxxxxx>
Date: Fri, 23 May 2003 10:21:13 +0200
Cc: gandalf@xxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, linux-net@xxxxxxxxxxxxxxx
In-reply-to: <20030522.180152.15252868.davem@xxxxxxxxxx>
References: <20030522.015815.91322249.davem@xxxxxxxxxx> <20030522.034058.71558626.davem@xxxxxxxxxx> <1053602138.9475.34.camel@xxxxxxxxxxxxxx> <20030522.180152.15252868.davem@xxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Thu, 22 May 2003 18:01:52 -0700 (PDT)
"David S. Miller" <davem@xxxxxxxxxx> wrote:

>    From: Martin Josefsson <gandalf@xxxxxxxxxxxxxx>
>    Date: 22 May 2003 13:15:39 +0200
> 
>    On Thu, 2003-05-22 at 12:40, David S. Miller wrote:
>    
>    > +static unsigned long size_to_order(unsigned long size)
>    
>    Any reason you're not using get_order() ?
> 
> Actually, get_order() aparently only works on powers of
> two, which 'size' is definitely not.

Are you sure? I always used it on all kinds of sizes.

The algorithm looks for me like it works on any size. A quick test
confirms that too.

(i386 version)
static __inline__ int get_order(unsigned long size)
{
        int order;

        size = (size-1) >> (PAGE_SHIFT-1);
        order = -1;
        do {
                size >>= 1;
                order++;
        } while (size);
        return order;
}


-Andi
> 

<Prev in Thread] Current Thread [Next in Thread>