Message ID | 20221114114344.18650-38-jirislaby@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098361wru; Mon, 14 Nov 2022 03:49:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Y/F0W/YUYZgQSioDvAyvonYlaNnnsq/NNiN/bIoqFURTPerD7Bv9ubOIdsVjY8OQ8WOix X-Received: by 2002:a17:906:79a:b0:73d:715c:5730 with SMTP id l26-20020a170906079a00b0073d715c5730mr9749147ejc.293.1668426588693; Mon, 14 Nov 2022 03:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426588; cv=none; d=google.com; s=arc-20160816; b=BiZyAs+p2n7PELxVir0Fz5iMiPnAQqF7sovXwT/TyiNyoru2j2U4/P1hk107r9FABa 4iE0qI1MjM1JGpAoa9kcYK27Jw4D447MffoVdoEZOZ0cpIiQZhmg8K2BVGLo/stXMkLM JsWexYVnkMUpUlSGGS4ojMI30tYcP781T35WhKzikNyz4hIN2tLAQM/8zdKw1VPi38Qz B3AMkDtm33zjCSOzC3+zFEaSGOT2Vcg6Nfp80Nsp9IJ3Tc3W2P5dIHKa7NJga0j7Buqd I8pr4wseN2GMJzw0VJbX3zg8uD0vR3lRMabgz2PiuEAFtdi0q1tfvGyjJyArwlYnHJPu 5m5Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jknY8RAzgdWn9SxfxApPWvhy4im0I1SE1/1URE6RX8I=; b=UwgPRVKsFt0tibvHXp8TlM1IIBjg20BNtIFvzlNsmd32fdy049DEFOdbcw1foEx1uj fEGDCnIsl9ZOidIal7Qc49MiNFd3fQgqTT3S4zQrggjXDCzUtOpfSEXCu8dV9TJW5y8C ShM7164dvFfZ03cn8o0zJY0GbookhT85CPwdfWmb/Mvnj4Zy+U1hGZ7A1oGsPhQfdMtk gt0kxrYT37C2vEHXcTtxMnjaF+tWuCbsDEv/7wb+wTQBJzQLgMrx0aJQaQ9m2TLJJ6+2 idU4rrp+aNj7wnjtVQasx937qEgDYFA2nfV1Lt9bkWfsL5ppMqI9TJZb6PyynnGwLJYC uk/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=la1ciPpE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb14-20020a170907960e00b007ae4717bf08si9733716ejc.359.2022.11.14.03.49.25; Mon, 14 Nov 2022 03:49:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=la1ciPpE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236414AbiKNLsR (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Mon, 14 Nov 2022 06:48:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236940AbiKNLra (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 06:47:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55BF824087 for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 03:45:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1881EB80E78 for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 11:45:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58D34C433C1; Mon, 14 Nov 2022 11:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426326; bh=F41S5/OfJJjx4Qyx7KDXsJWPyr7ThQmJ94m+jQiNNUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=la1ciPpE+MIEVxztF90HGogzquhV08rLd3CsVUecIZyEyXFO5P7K4UPkoTyfnvLqe oUMOIiKfbnSMlLH8X67gdclvvmnSs5uh/T5YUsCNDd3DXFnt2rd+wfoXNIpEdxsFcv TZRrtnoHYltBZ7AWs9y146QMRODFePDO4jpkTqcx6Aal5rcpFilq/Eak7oKV5xkEy/ V6+LPxwF7j1bSe9M7pjGIOt2c4yw7tnK6WEWxpIrge8ihcc+HmUtpvbi1ieF0BFe19 Lulw23FgtYKiIrJ5/qmL8ISkxM9W9u0k/OtloelPjQZrVLX9gUIIIR0DqsxVtL/EHQ 1CpfBlSEyzcfw== From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> To: linux-kernel@vger.kernel.org Cc: Andi Kleen <andi@firstfloor.org>, Miguel Ojeda <ojeda@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Martin Liska <mliska@suse.cz>, Jiri Slaby <jslaby@suse.cz> Subject: [PATCH 37/46] Compiler attributes, lto: disable __flatten with LTO Date: Mon, 14 Nov 2022 12:43:35 +0100 Message-Id: <20221114114344.18650-38-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472078682618351?= X-GMAIL-MSGID: =?utf-8?q?1749472078682618351?= |
Series |
gcc-LTO support for the kernel
|
|
Commit Message
Jiri Slaby
Nov. 14, 2022, 11:43 a.m. UTC
From: Andi Kleen <andi@firstfloor.org> Using __flatten causes a simple gcc 12 LTO build not fit into 16GB anymore. Disable flatten with LTO. With gcc 12, the build still does not finish linking in 10 minutes, eating 40GB of RAM at that point. There is an upstream bug about this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107014 Until this is resolved, simply disable __flatten with LTO. In the future, instead of this patch, we should likely drop __flatten and its only user (pcpu_build_alloc_info()) and use always_inline to all functions which shall be inlined there. Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Andi Kleen <andi@firstfloor.org> Signed-off-by: Martin Liska <mliska@suse.cz> Signed-off-by: Jiri Slaby <jslaby@suse.cz> --- include/linux/compiler_attributes.h | 5 +++++ 1 file changed, 5 insertions(+)
Comments
On Mon, Nov 14, 2022 at 12:45 PM Jiri Slaby (SUSE) <jirislaby@kernel.org> wrote: > > +#ifndef CONFIG_LTO_GCC > # define __flatten __attribute__((flatten)) > +#else > +/* Causes very large memory use with gcc in LTO mode */ > +# define __flatten > +#endif Currently, this header avoids attributes that depend on configuration options on purpose (see the comment at the top), so it would be best to move it elsewhere, e.g. `compiler_types.h`. Though I feel bad about having to move this attribute out since it is just that config option compared to other more involved bits in `compiler_types.h`... :( Cheers, Miguel
diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h index be6c71fd5ebb..09cf8eebcb0d 100644 --- a/include/linux/compiler_attributes.h +++ b/include/linux/compiler_attributes.h @@ -229,7 +229,12 @@ * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes * clang: https://clang.llvm.org/docs/AttributeReference.html#flatten */ +#ifndef CONFIG_LTO_GCC # define __flatten __attribute__((flatten)) +#else +/* Causes very large memory use with gcc in LTO mode */ +# define __flatten +#endif /* * Note the missing underscores.