lkml.org 
[lkml]   [2000]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] get_order() centralization
Jakub Jelinek wrote:
> I removed the bsrl implementation for Intel since the last patch because it
> really seems it is slower than a simple loop.

Besides, the timing is more important for small regions than large ones,
and that's how the loop is biased. If you're allocating a large region
you're likely to be doing a lot with it, so a little overhead in a loop
doesn't matter.

But seeing as we're here, did you try this code?

static const unsigned char table [32] =
{ 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };

size = (size - 1) >> PAGE_SHIFT; /* Let's assume it's 12. */
if (size >= (1 << 10)) { size >>= 10; order += 10; }
if (size >= (1 << 5)) { size >>= 5 ; order += 5; }
order += table [size];

enjoy,
-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.041 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site