From: Sumera Priyadarsini <sylphrenadin@gmail.com>
To: Julia.Lawall@lip6.fr
Cc: Gilles.Muller@lip6.fr, nicolas.palix@imag.fr,
michal.lkml@markovi.net, cocci@systeme.lip6.fr,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
Sumera Priyadarsini <sylphrenadin@gmail.com>
Subject: [PATCH] scripts: coccicheck: Change default value for parallelism
Date: Wed, 12 Aug 2020 23:57:22 +0530 [thread overview]
Message-ID: <20200812182722.4553-1-sylphrenadin@gmail.com> (raw)
By default, coccicheck utilizes all available threads to implement
parallelisation. However, when hyperthreading is enabled, this leads
to all threads per core being occupied resulting in longer wall-clock
times and higher power consumption. Hence, to improve performance,
modify coccicheck to use only one thread per core atmost.
In the cases where the total number of threads is more than 8 and
hyperthreading is enabled, it was observed that optimum performance
is achieved around one-fourth of the total number of cores.
Modify the script further to accommodate this use case.
Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
---
scripts/coccicheck | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/coccicheck b/scripts/coccicheck
index e04d328210ac..dd228dcc915e 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -75,8 +75,17 @@ 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
+ if [ $NPROC -gt 8 ] ; then
+ NPROC=$((NPROC/4))
+ else
+ NPROC=$((NPROC/2))
+ fi
+ fi
else
NPROC="$J"
fi
--
2.17.1
next reply other threads:[~2020-08-12 18:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-12 18:27 Sumera Priyadarsini [this message]
2020-08-12 20:15 ` [Cocci] " Julia Lawall
[not found] ` <CACAkLuqo+CJeyvVZ0oaN=6SqQNxXinfv8t6FNPyORO=GCCvstA@mail.gmail.com>
2020-08-13 10:57 ` 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=20200812182722.4553-1-sylphrenadin@gmail.com \
--to=sylphrenadin@gmail.com \
--cc=Gilles.Muller@lip6.fr \
--cc=Julia.Lawall@lip6.fr \
--cc=cocci@systeme.lip6.fr \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=nicolas.palix@imag.fr \
/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
all inboxes | Powered by JetHome®