Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage
From: Denis Efremov
Date: Sun Aug 25 2019 - 17:19:58 EST
> I think it's incorrect to say so in general. For example, on x86/64:
>
> $ make mrproper
> $ make allyesconfig
> $ make && mv vmlinux vmlinux-000
> $ make coccicheck MODE=patch COCCI=scripts/coccinelle/misc/unlikely.cocci | patch -p1
> $ make
> $ ./scripts/bloat-o-meter ./vmlinux-000 ./vmlinux
> add/remove: 0/0 grow/shrink: 3/4 up/down: 41/-35 (6)
> Function old new delta
> dpaa2_io_service_rearm 357 382 +25
> intel_pmu_hw_config 1277 1285 +8
> get_sigframe.isra.constprop 1657 1665 +8
> csum_partial_copy_from_user 605 603 -2
> wait_consider_task 3807 3797 -10
> __acct_update_integrals 384 373 -11
> pipe_to_sendpage 459 447 -12
> Total: Before=312759461, After=312759467, chg +0.00%
>
> It definitely influence the way the compiler optimizes the code.
Small addition:
Results with allyesconfig and KCOV, KASAN, KUBSAN, FTRACE, TRACE_BRANCH_PROFILING,
PROFILE_ALL_BRANCHES disabled:
./scripts/bloat-o-meter ./vmlinux-000 ./vmlinux
add/remove: 0/0 grow/shrink: 2/3 up/down: 22/-22 (0)
Function old new delta
i40e_xmit_xdp_ring 457 477 +20
__acct_update_integrals 127 129 +2
csum_partial_copy_from_user 208 207 -1
dpaa2_io_service_rearm 180 177 -3
wait_consider_task 1338 1320 -18
For defconfig:
./scripts/bloat-o-meter ./vmlinux-000 ./vmlinux
add/remove: 0/0 grow/shrink: 3/1 up/down: 16/-5 (11)
Function old new delta
do_signal 1513 1521 +8
wait_consider_task 2151 2157 +6
__acct_update_integrals 127 129 +2
csum_partial_copy_from_user 223 218 -5
Denis