]> git.baikalelectronics.ru Git - kernel.git/commit
kcalloc: remove runtime division
authorMilton Miller <miltonm@bga.com>
Thu, 24 Jul 2008 04:28:20 +0000 (21:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:21 +0000 (10:47 -0700)
commitcbbb3f4b4d61faf8731167828e1f1c13952131c2
tree2b6752e655484b1936ee1d410f272f9ff8b0305d
parentb80d8c7700d9fea0b6eb10d0af6c79bbbb0c783f
kcalloc: remove runtime division

While in all cases in the kernel we know the size of the elements to be
created, we don't always know the count of elements.  By commuting the size
and count in the overflow check, the compiler can reduce the runtime division
of size_t with a compare to a (unique) constant in these cases.

Signed-off-by: Milton Miller <miltonm@bga.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/slab.h