Re: [PATCH] get_order() centralization

From: Jamie Lokier (jamie.lokier@cern.ch)
Date: Mon Feb 14 2000 - 12:15:25 EST


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/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:27 EST