Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp785582pxa; Wed, 12 Aug 2020 13:18:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxagIMYQOoxcWjCj6DmQWlEE0y8Oh3KMnUXK+zCbAijNG4rUXzL/b4esfG8CuCPIrWsmk6 X-Received: by 2002:a17:906:5f8a:: with SMTP id a10mr1568390eju.379.1597263518968; Wed, 12 Aug 2020 13:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597263518; cv=none; d=google.com; s=arc-20160816; b=dfzA7nwEoZdFU31IKPRHb2MYnz5Cfm1cCnFASQb2PYwBtRYUu1Y6nVm+pkYgdqtT91 TG1OESmgf4TS7TfMbfHEiUbmpA2yjMt1L8CFCSjUEUGH5el/MGRXPY6TRn7DEGGa/Wxa kgN6z2sjwJ23ST8BX9JNKsRjK4KdeHbESPuAi7/VCuHYQW2dwhDbmsLtpXCf4szRQCxM p6MsL+iMlNi2KfkxDAxUup5r88G3N3RsFndtSwH+xoRZRAep+9wxUxSWP0GF97azwbpu j2a8gpLzWsFVhxo8RaUUjGeNTQeTyor3Ivk7C27cK3lzn2nto6FDD9QAv/qOIMrrSdw2 5zzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=KSVDmCd/QFx+PeWpGo4h2Qz36agP+RrG5mIQIfvaF0M=; b=VDB1FD+z0ns71ljfuz0MjNvKNPu1SGNh46qf00coNpK40t0xPqqLTcQN9jwMDjMkHU w5t+sNQiaPv4hcU9iVBtKM7qu1z3l+gRAKoUkoWaeml0nMP50JYaIEz7ad0wQ8L1prFN 4J+yH/px33iNE7DXy8DVY6lMp8qVLsUIfwz0cso0wdOhHsgs0QxoeOlPiWDSot4uSEyA 4f8+DuPkO6Xj4rA3z2QZNbhwFRYBcst0ZSHF/iDvfDAR2TpD27ReGNcQuJS8KjWIY6yv PkWXoYfjzMHX7YwPyC5dMtJiVbSOv9Dx2lkUoQW/r/M0BT7XpWdBOFdThOqUs84QsaYe 0O4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si2019372ejm.36.2020.08.12.13.18.15; Wed, 12 Aug 2020 13:18:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726576AbgHLUPe (ORCPT + 99 others); Wed, 12 Aug 2020 16:15:34 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:11565 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726512AbgHLUPe (ORCPT ); Wed, 12 Aug 2020 16:15:34 -0400 X-IronPort-AV: E=Sophos;i="5.76,305,1592863200"; d="scan'208";a="463289246" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2020 22:15:05 +0200 Date: Wed, 12 Aug 2020 22:15:04 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Sumera Priyadarsini cc: michal.lkml@markovi.net, Gilles.Muller@lip6.fr, gregkh@linuxfoundation.org, nicolas.palix@imag.fr, linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr Subject: Re: [Cocci] [PATCH] scripts: coccicheck: Change default value for parallelism In-Reply-To: <20200812182722.4553-1-sylphrenadin@gmail.com> Message-ID: References: <20200812182722.4553-1-sylphrenadin@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Aug 2020, Sumera Priyadarsini wrote: > 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. I have the feeling that the above sentence is not quite optimal. Actually, using all of the available hardware threads would not be a bad thing, if it was giving a benefit. The point is that it doesn't. It makes the performance worse instead. > Hence, to improve performance, > modify coccicheck to use only one thread per core atmost. "atmost" is not a word. It would be clearer to say "to use at most one thread per core". > 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. It would be nice to give some performance numbers and some information about the machine used. thanks, julia > > Signed-off-by: Sumera Priyadarsini > --- > 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 > > _______________________________________________ > Cocci mailing list > Cocci@systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci >