Re: Route cache performance under stress

From: Andi Kleen (ak@suse.de)
Date: Fri May 23 2003 - 03:21:13 EST


On Thu, 22 May 2003 18:01:52 -0700 (PDT)
"David S. Miller" <davem@redhat.com> wrote:

> From: Martin Josefsson <gandalf@wlug.westbo.se>
> 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
>
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html



This archive was generated by hypermail 2b29 : Fri May 23 2003 - 22:00:03 EST