Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1672321ioo; Sun, 22 May 2022 23:52:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2+MfsV5/sC7OzZagPOM6e4lppl8ON3Uy3VVHeuujc0auufSER10AyL/NJqR82jCS2Zf2G X-Received: by 2002:a17:90a:688a:b0:1df:6940:e83e with SMTP id a10-20020a17090a688a00b001df6940e83emr24293393pjd.120.1653288732980; Sun, 22 May 2022 23:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653288732; cv=none; d=google.com; s=arc-20160816; b=jrW4Or/XGnfbNi4c48i2Gty+u7vLJBtQz0F1A/1KCBnyzB/Sv/6u0wrRAsBqzbyfAa OuAxju2aih3O9PgodDobklttjoMTdqc3gKrW2AUNK5gaMzTK4SZKobkeg5JqreITYfF6 cvLcrugxSrAYu3vyF2hKkSNoevLH8ThAsj9H2CQKHMbwqkeF6iZIsqk1AM/41bDjJUOS +pd73w4SkCgIDPt4BZVxjQyy8jcnWbCOSb//a6wSlhr8bIXwT6Uh4JXKRowLS43GTVsD wFxGYio8hnt/iMxhHa+6SH3ZLCdyyVVFC0ZOSEuiNYbFmIFdHAHHYqpW6i6lT7tWeXke hfSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=E7Am5Nb9a8KomAfL0DWSpMGcRuyvDbO2H0enFw86lac=; b=Q/g1dqK8JTYV8ul2hPurkMnhvFT9WkX2Kf3MJTLZe9wooLDNUc2ZrxbEiW7pKrfXfc vAWOvGBOXyKeA3SZD4e5zGhWA05quo7lH1oLTon8TvVY7uOic+R75nFBDe25bdN7h5M9 YlFd4RDOwfdHFKr0EW5QDRifHXMmVPzGTZvvJL5IpWUgOpdhmLtzBywr1wTyoyM/1yAi fAsfGuj5URd/YXac8aglWybELs7QX3Jm6+ydQ/KllkhExHzVoRecHiw/943REH6UN+77 ksDXiEVRuALzY3ARzxLWaEDflQXeHAoVoUniU4mcJ7qBJFbK0qnL4oM53/uHv1fPfxsB Km1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Mmss+paM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r195-20020a632bcc000000b003f285ba5a9csi9191508pgr.762.2022.05.22.23.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:52:12 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Mmss+paM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D6DA54FA1; Sun, 22 May 2022 23:20:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355405AbiEUPkE (ORCPT + 99 others); Sat, 21 May 2022 11:40:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355508AbiEUPjj (ORCPT ); Sat, 21 May 2022 11:39:39 -0400 Received: from conssluserg-01.nifty.com (conssluserg-01.nifty.com [210.131.2.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CB596351C; Sat, 21 May 2022 08:39:18 -0700 (PDT) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 24LFcxRn020449; Sun, 22 May 2022 00:38:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 24LFcxRn020449 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1653147539; bh=E7Am5Nb9a8KomAfL0DWSpMGcRuyvDbO2H0enFw86lac=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Mmss+paMa26fLx30DM4uAjXe+hi1m5UbvsADimGmzr7IWvQyc6/ycCqMbIK6Sn8xm T8VwUVO3Eb1qe8Ct//Bc39+yvk+sWAe9GrN4+miP74KPs7FZWo/AWwG2sSzz8rp6YJ OjAWhOOp6Q7/c1cINOoO8uIqMg3jqxM3Cu8HIlLWrRtdpdT9kS0Z9w3vPlWHVnmuhw vY83rN/VIt3qDm1xePB8sQeGYLmXCE8l6aaeAP3VzyO6rWCc00bN41VzyhIO3SKIwM ROjBLWIkgYW6pr89ytbBmjv53x9OjiLIRYTXGphXiw5fqg4rgR7YU9rK6X5rkZe/dq KwU/UWjM4qW6A== X-Nifty-SrcIP: [209.85.210.173] Received: by mail-pf1-f173.google.com with SMTP id w200so10053813pfc.10; Sat, 21 May 2022 08:38:59 -0700 (PDT) X-Gm-Message-State: AOAM533x//zvxN8lLJ3Zh6SQEJZBrqiYTOR0w3wLftJ5RwjoxCr+zImk W710Y5drRv2OGQ2OhSKti1HqxJZEhkzyhHbydIg= X-Received: by 2002:a63:9043:0:b0:3f9:6c36:3de3 with SMTP id a64-20020a639043000000b003f96c363de3mr5866156pge.616.1653147535087; Sat, 21 May 2022 08:38:55 -0700 (PDT) MIME-Version: 1.0 References: <23e0ba7863d51ab629498762a97d477645aeafea.1653123744.git.christophe.jaillet@wanadoo.fr> In-Reply-To: <23e0ba7863d51ab629498762a97d477645aeafea.1653123744.git.christophe.jaillet@wanadoo.fr> From: Masahiro Yamada Date: Sun, 22 May 2022 00:38:17 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] kbuild: Add an option to enable -O1 and speed-up compilation time To: Christophe JAILLET Cc: Dan Carpenter , Michal Marek , Nick Desaulniers , Linux Kernel Mailing List , kernel-janitors@vger.kernel.org, Linux Kbuild mailing list , Arnd Bergmann , Changbin Du Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 (+CC: Arnd, Changbin Du) If -O1 support does not require additional effort, I have no objection to this patch. (but I do not have enough insight about the compiler's inlining heuristic) BTW, when we attempted to add the -Og support, we fixed various parts, and Linus rejected it. https://lore.kernel.org/linux-kbuild/CAK7LNARQggM3aKEPRKJqa4tunFAfmfErMZuS-rrnRv6UB1VpPQ@mail.gmail.com/ On Sat, May 21, 2022 at 6:04 PM Christophe JAILLET wrote: > > 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 > -- Best Regards Masahiro Yamada