]> git.baikalelectronics.ru Git - kernel.git/commit
mm/dmapool.c: micro-optimisation remove unnecessary branch
authorMateusz Nosek <mateusznosek0@gmail.com>
Tue, 7 Apr 2020 03:08:49 +0000 (20:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2020 17:43:42 +0000 (10:43 -0700)
commit6163a26c3cd4e9b20ae64f1948f110ea6f75989c
tree90e9f94f112a2c2b5eeda15c10fe9a33b882ec53
parent549fcb98e8e5a16123e5fb993248bb6906fc9412
mm/dmapool.c: micro-optimisation remove unnecessary branch

Previously there was a check if 'size' is aligned to 'align' and if not
then it was aligned.  This check was expensive as both branch and division
are expensive instructions in most architectures.  'ALIGN' function on
already aligned value will not change it, and as it is cheaper than branch
+ division it can be executed all the time and branch can be removed.

Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20200320173317.26408-1-mateusznosek0@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/dmapool.c