Re: CK1 [06/13] Common kmalloc slab index determination

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

 



On Fri, 28 Sep 2012, Glauber Costa wrote:

> > +	if (size <=  8 * 1024 * 1024) return 23;
> > +	if (size <=  16 * 1024 * 1024) return 24;
> > +	if (size <=  32 * 1024 * 1024) return 26;
> > +	if (size <=  64 * 1024 * 1024) return 27;
> > +	BUG();
> > +
> > +	/* Will never be reached. Needed because the compiler may complain */
> > +	return -1;
> > +}
> > +
>
> That is a bunch of branches... can't we use ilog2 for that somehow ?

Believe me we have tried but the c compiler had issue with constant
folding. ilog2 is used for the non inlined version.

> In any case, you skipped "return 25".

Thanks. Fixed.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]