Thread (209 messages) 209 messages, 18 authors, 2003-06-17

Re: Route cache performance under stress

From: Andi Kleen <hidden>
Date: 2003-05-23 08:21:13

Possibly related (same subject, not in this thread)

On Thu, 22 May 2003 18:01:52 -0700 (PDT)
"David S. Miller" [off-list ref] wrote:
   From: Martin Josefsson [off-list ref]
   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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help