Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2594159pxk; Sun, 27 Sep 2020 13:59:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymANO+5etIG9mpkhIy3uWzm9aucCdeY54r9x2AwENncDlquAPdj/tp000dCbT60N+EiLxv X-Received: by 2002:a17:906:4087:: with SMTP id u7mr12776756ejj.466.1601240389561; Sun, 27 Sep 2020 13:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601240389; cv=none; d=google.com; s=arc-20160816; b=Mej+C9Jg7aUi91X/CyhukfXsfQ1KHg5SNcgZSGugjUvqdwDex2u51Yhz3M6wTRgBda DLZsXNkRG0Co0SXj6WTydNxtcbvspBd/DCDxp1DUoDwD3xEl+eWc8EyIqutsO+/7YbzW CfOFPrD36+pq9851HgaoqowA8OVXV/S/vK3VI1yq9/XvL5xoES4vaPAY2mwTv62FuktF snv2FCyNJYTb4e2tL0H3rBMpYVjIvjmtXcWUZ90wk1XlrpJAoN+n6cAV4tXVs2/Ha9Ga BTYjD3p+BEcU//yCVAr4XyLrw9YUgfkn/rWwr0OhfbSoc4nnHgFvssi9GL9ozeD/FITI By4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=ZcVCXz9XbDKo9S+IOlNUdyXXtc0SVE08KeQLpx3Q3Tc=; b=wCjPPd25voZ/RmMR1GusAnUQx/s5ZJSRnZw0e99kNhrxhZyBMFrjAd+npKlutYANyB 5bIIHqtR0cYLknuMDceHKEGOCIQpC9F93JKd95a6mtKeJk/hsrH6RlVTOyxIPvxU//CJ jV89AOX3nwdlf5Qf67AY2J8p6qvCe+aA5HHGBac4P+pBD65hnVpgrY6ntRkwlrVGCPHN Biti8SPnSrzKKKmtVxtwpJJUxJXREOn2bCUy5dgIUqsfoeRA+zxUZvjkyLQ+SB9G58ng zsBU1RMRbJ2x26eL0aCv3eo2elFwH4KV9EFImKT2r5S7spJfg8uHu363Uj5EfacIgoV5 rCeg== 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 s3si6376895ejv.383.2020.09.27.13.59.26; Sun, 27 Sep 2020 13:59:49 -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 S1726460AbgI0Uzz (ORCPT + 99 others); Sun, 27 Sep 2020 16:55:55 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:1181 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgI0Uzy (ORCPT ); Sun, 27 Sep 2020 16:55:54 -0400 X-IronPort-AV: E=Sophos;i="5.77,311,1596492000"; d="scan'208";a="469746023" 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; 27 Sep 2020 22:55:53 +0200 Date: Sun, 27 Sep 2020 22:55:52 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Sumera Priyadarsini 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 In-Reply-To: <3beb97122995eafe3f0b831e36167b1edadb47c5.1600945451.git.sylphrenadin@gmail.com> Message-ID: References: <3beb97122995eafe3f0b831e36167b1edadb47c5.1600945451.git.sylphrenadin@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 >