diff options
| author | George Spelvin <[email protected]> | 2019-05-14 22:42:55 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2019-05-15 02:52:49 +0000 |
| commit | 8fb583c4258d08f0aff105aa2ae5157b7d414ea2 (patch) | |
| tree | d45dd566badd42d1c13507ea01e890e07dd0ade3 /lib/bitmap.c | |
| parent | lib/sort: use more efficient bottom-up heapsort variant (diff) | |
| download | kernel-8fb583c4258d08f0aff105aa2ae5157b7d414ea2.tar.gz kernel-8fb583c4258d08f0aff105aa2ae5157b7d414ea2.zip | |
lib/sort: avoid indirect calls to built-in swap
Similar to what's being done in the net code, this takes advantage of
the fact that most invocations use only a few common swap functions, and
replaces indirect calls to them with (highly predictable) conditional
branches. (The downside, of course, is that if you *do* use a custom
swap function, there are a few extra predicted branches on the code
path.)
This actually *shrinks* the x86-64 code, because it inlines the various
swap functions inside do_swap, eliding function prologues & epilogues.
x86-64 code size 767 -> 703 bytes (-64)
Link: http://lkml.kernel.org/r/d10c5d4b393a1847f32f5b26f4bbaa2857140e1e.1552704200.git.lkml@sdf.org
Signed-off-by: George Spelvin <[email protected]>
Acked-by: Andrey Abramov <[email protected]>
Acked-by: Rasmus Villemoes <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Cc: Daniel Wagner <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Don Mullis <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/bitmap.c')
0 files changed, 0 insertions, 0 deletions
