From: Julia Lawall <julia.lawall@inria.fr>
To: Sumera Priyadarsini <sylphrenadin@gmail.com>
Cc: corbet@lwn.net, michal.lkml@markovi.net, Gilles.Muller@lip6.fr,
linux-doc@vger.kernel.org, nicolas.palix@imag.fr,
linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr
Subject: Re: [Cocci] [PATCH 1/2] scripts: coccicheck: Change default value for parallelism
Date: Sun, 27 Sep 2020 22:55:52 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2009272255220.20726@hadrien> (raw)
In-Reply-To: <3beb97122995eafe3f0b831e36167b1edadb47c5.1600945451.git.sylphrenadin@gmail.com>
On Thu, 24 Sep 2020, Sumera Priyadarsini wrote:
> 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>
I have applied this one, so just the patch on the docuemtnation needs to
be improved.
julia
>
> ---
> Changes in V2:
> - Change commit message as suggested by Julia Lawall
> Changes in V3:
> - Use J/2 as optimal value for machines with more
> than 8 hyperthreads as well.
> ---
> scripts/coccicheck | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index e04d328210ac..a72aa6c037ff 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -75,8 +75,13 @@ else
> OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE"
> fi
>
> + # Use only one thread per core by default if hyperthreading is enabled
> + THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd [:digit:])
> if [ -z "$J" ]; then
> NPROC=$(getconf _NPROCESSORS_ONLN)
> + if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 2 ] ; then
> + NPROC=$((NPROC/2))
> + fi
> else
> NPROC="$J"
> fi
> --
> 2.25.1
>
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
next prev parent reply other threads:[~2020-09-27 21:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 11:23 [PATCH 0/2] Improve Coccinelle Parallelisation Sumera Priyadarsini
2020-09-24 11:26 ` [PATCH 1/2] scripts: coccicheck: Change default value for parallelism Sumera Priyadarsini
2020-09-27 20:55 ` Julia Lawall [this message]
2020-09-24 11:27 ` [PATCH 2/2] Documentation: Coccinelle: Modify parallelisation information in docs Sumera Priyadarsini
2020-09-27 20:55 ` [Cocci] " Julia Lawall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.22.394.2009272255220.20726@hadrien \
--to=julia.lawall@inria.fr \
--cc=Gilles.Muller@lip6.fr \
--cc=cocci@systeme.lip6.fr \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=nicolas.palix@imag.fr \
--cc=sylphrenadin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox