Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scripts: coccicheck: Change default value for parallelism

By default, coccicheck utilizes all available threads to implement
parallelisation. However, when all available threads are used,
a decrease in performance is noted. The elapsed time is minimum
when at most one thread per core is used.

For example, on benchmarking the semantic patch kfree.cocci for
usb/serial using hyperfine, the outputs obtained for J=5 and J=2
are 1.32 and 1.90 times faster than those for J=10 and J=9
respectively for two separate runs. For the larger drivers/staging
directory, minimium elapsed time is obtained for J=3 which is 1.86
times faster than that for J=12. The optimal J value does not
exceed 6 in any of the test runs. The benchmarks are run on a machine
with 6 cores, with 2 threads per core, i.e, 12 hyperthreads in all.

To improve performance, modify coccicheck to use at most only
one thread per core by default.

Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

authored by

Sumera Priyadarsini and committed by
Julia Lawall
e16a7c47 b76f0ea0

+5
+5
scripts/coccicheck
··· 75 75 OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE" 76 76 fi 77 77 78 + # Use only one thread per core by default if hyperthreading is enabled 79 + THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd [:digit:]) 78 80 if [ -z "$J" ]; then 79 81 NPROC=$(getconf _NPROCESSORS_ONLN) 82 + if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 2 ] ; then 83 + NPROC=$((NPROC/2)) 84 + fi 80 85 else 81 86 NPROC="$J" 82 87 fi