[lkml]   [2001]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: slab: avoid linear search in kmalloc? (GCC Guru wanted :)
>>>>> "Arjan" == Arjan van de Ven <> writes:

Arjan> Momchil Velikov wrote:
>> >>>>> "Bernd" == Bernd Eckenfels <> writes:
Bernd> Hello,
Bernd> I noticed that kmalloc and kmem_find_general_cachep are doing a linear
Bernd> search in the cache_sizes array. Isnt it better to speed that up by doing a
Bernd> binary search or a b-tree if like the following patch?
>> Here is a patch using a gcc extension. gcc generates binary search for the case.

Arjan> the big "case" statement makes you wonder if ffz(~size) would do the
Arjan> same ;)

*Nod*, espesially on architectures, where it is a single instruction.

OTOH, this is possible only if the sizes are powers of two. And they
could be more closely sparsed ...


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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