Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3274160lfo; Mon, 23 May 2022 00:26:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/pkC2Crv0i/bMo1jw0yiTgsoOTgO+tklCez3JVr3XIdxaVVJFYgiZdZb1jMLsknnsED+1 X-Received: by 2002:a05:6a00:8ce:b0:510:9298:ea26 with SMTP id s14-20020a056a0008ce00b005109298ea26mr22322298pfu.55.1653290808559; Mon, 23 May 2022 00:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653290808; cv=none; d=google.com; s=arc-20160816; b=jrpKN9njnDGqhy36RNKgwfw/+z1Q5znC5QriNVlRotbsoxA6+cyWSkoPkZ12MYbnwy UKQhvgXOytBwU9vWXcRz+7/U9aFVZfKpkXnIhIb1tmN+JsbuC88TjG5aRtnA5RBL47SG t9H201WPh8Q6r+l6P0KPsFWL4DYNsYd/fZKQCmCO/d4wAoByKvGhspQraVyOC70OFh3+ /EgwIKhSnIgMopyKw9VDAA1E+xxCnBsRofwQ4PAIubYjY6ZzE3RDlIvniv/hV062tIBt 6Sqxg5a/EeuYZvEUl9B4YSdp6DVnQX3TooPOSBgucH+GMmVZ8vIJHNTPItwr0ymD0Wsf vgeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=yuFi95stPN1ZKVdx4xBNIBh528yvge6zIftuUq0d13g=; b=ktOeS4IoM4aF/fIAImmIeIsUcHssGNf+7nfGGKiRuqN1PgkRJr79J/Pw5TMdqMNNMp OamxQHIliAnY9rbypakX59h/Kw/8ZkBLw6T4EPt6fVFFKB1WfUpqu7tfg4UF0M2klUZr v5fWjKkdGKTam9putGM81JbyrvWpAZcJWxPrR1jXFNsYRLwhMS3hskDKhQ8nbyhR6F+c UUK9EUzmYICMoxeL0AzX98wklrFRyWK6x5ycf1kxKGvRFYcYMXTOE0he+mKcqbVtFyQw FMhNmeLkx/S2EpVNQuQf2dBB6MSyb+Y80kdntFPQdlbiQtCN0etajQH7RVuXPUTdr7Z7 Huwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i17-20020a170902c95100b0015ef9e02dccsi9714230pla.102.2022.05.23.00.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:26:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 495984B404; Sun, 22 May 2022 23:40:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232591AbiEUJEt (ORCPT + 99 others); Sat, 21 May 2022 05:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240543AbiEUJEq (ORCPT ); Sat, 21 May 2022 05:04:46 -0400 Received: from smtp.smtpout.orange.fr (smtp03.smtpout.orange.fr [80.12.242.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4038D02A7 for ; Sat, 21 May 2022 02:04:44 -0700 (PDT) Received: from pop-os.home ([86.243.180.246]) by smtp.orange.fr with ESMTPA id sL2Nnv20T4LtqsL2NnX8nM; Sat, 21 May 2022 11:04:42 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sat, 21 May 2022 11:04:42 +0200 X-ME-IP: 86.243.180.246 From: Christophe JAILLET To: dan.carpenter@oracle.com, Masahiro Yamada , Michal Marek , Nick Desaulniers Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-kbuild@vger.kernel.org Subject: [RFC PATCH] kbuild: Add an option to enable -O1 and speed-up compilation time Date: Sat, 21 May 2022 11:04:29 +0200 Message-Id: <23e0ba7863d51ab629498762a97d477645aeafea.1653123744.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new compilation option which speeds-up compilation time. This can be useful when using static checker such as smatch or build-bots. In such cases, the speed and quality of the generated code is not important. Using -O0 would be even better, but unfortunately, building fails with this option. Signed-off-by: Christophe JAILLET --- Makefile | 5 ++++- init/Kconfig | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1f8bef92868f..14467386f947 100644 --- a/Makefile +++ b/Makefile @@ -817,7 +817,10 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) -ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE +ifdef CONFIG_CC_OPTIMIZE_FOR_COMPILATION_SPEED +KBUILD_CFLAGS += -O1 +KBUILD_RUSTFLAGS_OPT_LEVEL_MAP := 1 +else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE KBUILD_CFLAGS += -O2 KBUILD_RUSTFLAGS_OPT_LEVEL_MAP := 2 else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 diff --git a/init/Kconfig b/init/Kconfig index a96776a9b080..3177a1830c9a 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1384,6 +1384,14 @@ choice prompt "Compiler optimization level" default CC_OPTIMIZE_FOR_PERFORMANCE +config CC_OPTIMIZE_FOR_COMPILATION_SPEED + bool "Optimize for compilation speed (-O1)" + help + This option can be useful when running a static checker such as smatch + or a build-bot. + Compilation time is slighly faster than -O2 and it requires less + memory. + config CC_OPTIMIZE_FOR_PERFORMANCE bool "Optimize for performance (-O2)" help -- 2.34.1