Re: Route cache performance under stress

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

 



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
> 
-
: 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

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux