Thread (3 messages) 3 messages, 2 authors, 2012-09-28

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

From: Christoph Lameter <hidden>
Date: 2012-09-28 14:16:48

On Fri, 28 Sep 2012, Glauber Costa wrote:
quoted
+	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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help