Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp709679pxa; Wed, 12 Aug 2020 11:30:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHhUd0m1G6lJfEG9vNcHhuzoRm0j21VDmKYnYnm4avZ17jtwud4CSbAY1sfDHGihc6LENc X-Received: by 2002:a50:ba85:: with SMTP id x5mr1202342ede.38.1597257001152; Wed, 12 Aug 2020 11:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597257001; cv=none; d=google.com; s=arc-20160816; b=ux3q8OqfCmURPnzQDgzpePtCcfjpYQyvVzUSRRaLgq/hn/8j2RPpjzL4AyYs13q6mm QNWXGkq4HSsDh3WA2+FFjOC4KeSlg5XbTXENHoJ0QEcBeiFRyDQKkbap72DpgFuy9Fqk XJWG0jo7xgJWMJCeVMPXa/CxDIEd5tkjlOP9wa1RAQuPDcYtLh3RgDSe1i9AqlrhRoNg tupxM1faV+2aofYpz+47eGN/y3GYlKAXTUCeVbko5QnUHoe7luRm7PhJhWtX1UqnFwIQ +1FLajIO4UFPr+Qmz3XK4eHrIlyLwWiBbHv84z+VAEwiPOfl+peUCJO9bJEfQFC/jwv4 4RCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Z12EV34czuh/q8HI4kW7uvaEJ50bFNuDIiyEV0Yi0MA=; b=dC5JsB1ZxJYli7bZ2h3xUl9O0mukUr+c1lSfFWEuIiz4W6uzVwbl8k8hR0jvUqsaZf PYFQgK6ZQQYJiY83BDcB1iIoKU4RR+ku3SSFz6WfY6a3rUy/3oPCWnwYmGRAspsPjoD8 T4B+9Dt21jQ+A6p5/EPM+ZpkHIkyUDH7fSOpOYaQlvqfRwXcDjIizAn1BqlmBzKTQykL 1Oqgtl3segstTtG1hIwYoWhTh4P0Nfzm8E6HoSLXwRVOdj9ZUYgG6DDueTd5o5d9cjJI 2no0YDcPukJhzkQygfftvJ2wO2FogJwQfyjnR8rMIrPCgAHWmyJqhnfQpUBstUFRnegr GIIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZQa7Biuq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si1932389edp.392.2020.08.12.11.29.34; Wed, 12 Aug 2020 11:30:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZQa7Biuq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726521AbgHLS16 (ORCPT + 99 others); Wed, 12 Aug 2020 14:27:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726447AbgHLS16 (ORCPT ); Wed, 12 Aug 2020 14:27:58 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4EF3C061383 for ; Wed, 12 Aug 2020 11:27:57 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id d4so1554949pjx.5 for ; Wed, 12 Aug 2020 11:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Z12EV34czuh/q8HI4kW7uvaEJ50bFNuDIiyEV0Yi0MA=; b=ZQa7BiuqEvG9sR814NBToxsuC6xwgsO5zCoPRnOjyDQOcRwn6dwO++9qNVlIe2GgHW vAkVRjnVqajBGDnfo6wXpal0I77AFLqgB8Z11oDNVku7tfduXavYOwDIF2Z/xQtnEHX8 4e4fU3fuV+xjRSK6NxEx/7krWi6T33GHlodUA8pW4LrxlJHJXBZNXzRJmBHB/AozD2Z6 +3rdEY0whqSlw2AuFd5qz/pUA9m5NW96lZhW8bsneemqakEmLjRJdfrlqT/gXvrBsXMi AOVN2n8Fpmj2LHX+1/HR6XfaC+yVUlCFJxYY/TggwoACz7G8FzowUGAomSPycBwQesnN AjUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Z12EV34czuh/q8HI4kW7uvaEJ50bFNuDIiyEV0Yi0MA=; b=r0yajtKiaGA4OsbvaFttuysRsZQXh4xJM/Tv8aoH2TQk+kgvkyu/6VtdvrxMLA4j+O 59mPnjYZ1gOA7FHTWC+tMkmhlz8BUoU0V+Ekq67cuGcZRBNYzM82wvtF9FUs4bBUDpnr WHzKD6MGnwOijahxHkYw8LF5UiBUVXmb3SHfeFHqY27UGeH7KgjXaAY78Yw0VxPHeqRi m20xai9mdxV2TbNknF8Qx5PuAzATMyzc/Jcq5A1jGaJFCF3JA42vtl6qYR3RUekAJyts WJboF/i7ziQlafWj2+9rf3h2Q6ksTrEis/Ox/mMh/L8ZH/nZcZnzfQhV8OBj3k9cm8RR lvGA== X-Gm-Message-State: AOAM533D2zAr2sW6Eq0Iw7pRMjvRkhEqQai5Gy98qpkLVs/A4DnJajOL CjbnAzrn3RaX2XmUWp0WgljVt3GvIaQ= X-Received: by 2002:a17:902:8546:: with SMTP id d6mr659792plo.218.1597256877219; Wed, 12 Aug 2020 11:27:57 -0700 (PDT) Received: from localhost.localdomain ([106.51.107.61]) by smtp.gmail.com with ESMTPSA id 80sm3128627pfy.147.2020.08.12.11.27.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 11:27:56 -0700 (PDT) From: Sumera Priyadarsini 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 Subject: [PATCH] scripts: coccicheck: Change default value for parallelism Date: Wed, 12 Aug 2020 23:57:22 +0530 Message-Id: <20200812182722.4553-1-sylphrenadin@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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