From patchwork Thu Jun 1 14:57:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9759785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA36B602BC for ; Thu, 1 Jun 2017 14:58:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAAB1284ED for ; Thu, 1 Jun 2017 14:58:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF4CF28501; Thu, 1 Jun 2017 14:58:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 818D8284F9 for ; Thu, 1 Jun 2017 14:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751189AbdFAO5x (ORCPT ); Thu, 1 Jun 2017 10:57:53 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:49489 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751266AbdFAO5w (ORCPT ); Thu, 1 Jun 2017 10:57:52 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MQaxF-1dSqWW12E9-00Tz27; Thu, 01 Jun 2017 16:57:17 +0200 From: Arnd Bergmann To: Masahiro Yamada Cc: Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, sam@ravnborg.org, Arnd Bergmann Subject: [PATCH] kbuild: speed up checksyscalls.sh Date: Thu, 1 Jun 2017 16:57:07 +0200 Message-Id: <20170601145707.590629-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:gUny4YpkV2ZwjCSy0u3V93pW/WPoVLTzQq8HLPUSsHyV9yN4Lgj cFi00OzAQCFnOnYXgleHAtE4KAd8m/4RgBlv8Hd90rD2jXBhcaojUsaqUojKYh2ReFyXZhk M9hMjslQg6uXqgz9I1z+8dUFfbo++SaeovLwjJ6F8mNagRR//pqymGpDoxAGEiDbw5Aa0cV 60cAF89HAbVA7/NKCQMgg== X-UI-Out-Filterresults: notjunk:1; V01:K0:5e5ZnDmMZDA=:cSJQct7MWKpz/QYFX9wfWW XQG1jFxlaK7A+30LLA5Ho4er5ePssy7LcR77ewIptF7GqrI9Gi+i2QGGL5n+M0zYs48JuU8J0 RCzd5ISxzbtvVx2ByTn+iybA9/YRmQuk6W2OpmndoIX+JR+0EJQoR16cDzYk93As5kGVv6s43 5As/dpuoWKnT1FOqN8w/V2AtWB2KKmQ3JO6CUG+/BkpsM4WNXbfsy6YR5EMHjEE8PAtQcfHxu g14kOTGTpjk3RwlZSis/EfjoBMEzdtqFCaOQSwS4AZYcNc9lUiWtzYRWhtmlJ35lE5sZURDSs o2OPhLNT6cpBJodmL68D3Nibqj9pRPCFhpPFxZvvnJfORrtPpp6RUItaDPc7/grFzxyehlswG FeMusJOP9W7s9jt10rZEtQ1hp3wVy1G+a2Ub4jBuGYBYjmOy3o76XIKXAAtTs/1Q0mGCNAqhd hcr7bJGfIUFEhtB1bMedM5EdapkkG8fJEdhUsF1w2dbVt+VOcIpe9mJI5gaDeypV/L0VwF0fZ 7SHcMgFudjKnqbkwOtkAYmb7G0a83Tj8LWyflMLcNSQzpcDoaNLJiVPwOuMWpB/YNk8dI1y6c k5gn7TaeGPITL6jcO9yX/xrflEnb7l0KLtxxqkE9Wz7dZhesVGsfrMJV7rhejOPAR/paOl8v7 GrXilYioNX2ST/bHB9nGtOp5LdMnZ1g+aEMWSKODO5lyb99BzYvpBWmkqxaEgTFZynzs= Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP checksyscalls.sh is run at every "make" run while building the kernel, even if no files have changed. I looked at where we spend time in a trivial empty rebuild and found checksyscalls.sh to be a source of noticeable overhead, as it spawns a lot of child processes just to call 'cat' copying from stdin to stdout, once for each of the over 400 x86 syscalls. Using a shell-builtin (echo) instead of the external command gives us a 13x speedup: Before After real 0m1.018s real 0m0.077s user 0m0.068s user 0m0.048s sys 0m0.156s sys 0m0.024s The time it took to rebuild a single file on my machine dropped from 5.5 seconds to 4.5 seconds. Signed-off-by: Arnd Bergmann --- scripts/checksyscalls.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index 0cce56da3706..b8c9d2b04ffc 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh @@ -231,15 +231,12 @@ EOF } syscall_list() { - grep '^[0-9]' "$1" | sort -n | ( + grep '^[0-9]' "$1" | sort -n | while read nr abi name entry ; do - cat <