From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AD4BC433DB for ; Fri, 26 Feb 2021 08:15:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D51B64EE2 for ; Fri, 26 Feb 2021 08:15:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D51B64EE2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UFe2DHDA3U1JMmlV1I7dEXCJIA8ORZ8DI3ecHIDPZNo=; b=MUa/EipT//Hc+gEbahhGHHEpd cX1qMlpqBWFZolUHYifVqAdguNrLuO9VP3QZepQxrNKMIyiwgolNptyfpd7aEBwGdraorXp4xbwQe ex5PYEUGU8zujhxyTT1okPX0M5VgAbiggGPn8p+lAqC06A+Tnk4yiC1ABIIfHNBkhCpCwsvyn3SBL ClgrfokWvXdrtXsEmXk3tq2v4feK/ruR5TaY10lE71yxwIf63jr9+Fgwloe2ihfVgswbOBYSxrPwH nRNf+heUZeIprgz67Ql3MsNTraAbYZ7iDo/NtJLcYSSio8xicP4SSIwkJOOLGSoVPSgvWIybWDkxE oPk990xTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFYGe-0004b1-0x; Fri, 26 Feb 2021 08:14:32 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFYGa-0004aU-9x for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 08:14:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7702764EEB for ; Fri, 26 Feb 2021 08:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614327266; bh=Eo2tKPNmvmbEpnYKsR3W4TzcmK2bAwkJr9OFxHhNTPA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=n9feerzoyPz2GZ1ZWK1yrvTGwB6yEs646LEEIwgf7C/AxiSw1HkJ1UDS5DTSU0HaK NCEi76biGLZq5PjDczGLDUlR7SS8FIkYe9iMBhaFws0nHm0zqpl1G+NZIyd7sE3jrJ AaBUM0fFJX7gyDd8VLBJj3w+NTejzSr0+sshpbmViDOyvorzt5+QeL4PMYnfeUEDcf tYq6O0Exx8b0A8jSP36lVis0LRaxGCR2l/1qRqY1tKXx19wxa2LQvHdRcms1Q/5Tgr tkScCnD7bSzEa7OeB8kUsp9STZtsg/pHAH3NB51aFPpksHpjFGIC7A2/FTqkk3M4Vt s0kyF7vWlYF4Q== Received: by mail-oi1-f170.google.com with SMTP id j1so8972143oiw.3 for ; Fri, 26 Feb 2021 00:14:26 -0800 (PST) X-Gm-Message-State: AOAM530DIZ22fmo7Avcb0NjqasQK1KhC3y1NsGRj520P0kAoIibxB6EJ zrYCAsRgK8iuzV1M7w3E1+j7kaFABjJsXhe6aWY= X-Google-Smtp-Source: ABdhPJzKfPEDoJuQo8Zs6R2bVcnz5F6nl0/rf60VZJ1iVoxVaQpBMnDHAU0IhDLZCa06jnEc6nzP5E4WZDvA54/7xEg= X-Received: by 2002:aca:4a47:: with SMTP id x68mr1202138oia.67.1614327265563; Fri, 26 Feb 2021 00:14:25 -0800 (PST) MIME-Version: 1.0 References: <20210225112122.2198845-1-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Fri, 26 Feb 2021 09:14:09 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION To: Sedat Dilek X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210226_031429_166572_EEAD3F70 X-CRM114-Status: GOOD ( 22.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ionela Voinescu , Kees Cook , Arnd Bergmann , Catalin Marinas , Nick Desaulniers , "linux-kernel@vger.kernel.org" , Kristina Martsenko , Ard Biesheuvel , Nathan Chancellor , Clang-Built-Linux ML , Mark Brown , Andrew Scull , Marc Zyngier , Geert Uytterhoeven , Vincenzo Frascino , Will Deacon , David Brazdil , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 26, 2021 at 1:36 AM Sedat Dilek wrote: > > On Thu, Feb 25, 2021 at 12:21 PM Arnd Bergmann wrote: > > > > From: Arnd Bergmann > > > > When looking at kernel size optimizations, I found that arm64 > > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, > > which enables the --gc-sections flag to the linker. > > > > I see that for a defconfig build with llvm, there are some > > notable improvements from enabling this, in particular when > > combined with the recently added CONFIG_LTO_CLANG_THIN > > and CONFIG_TRIM_UNUSED_KSYMS: > > > > text data bss dec hex filename > > 16570322 10998617 506468 28075407 1ac658f defconfig/vmlinux > > 16318793 10569913 506468 27395174 1a20466 trim_defconfig/vmlinux > > 16281234 10984848 504291 27770373 1a7be05 gc_defconfig/vmlinux > > 16029705 10556880 504355 27090940 19d5ffc gc+trim_defconfig/vmlinux > > 17040142 11102945 504196 28647283 1b51f73 thinlto_defconfig/vmlinux > > 16788613 10663201 504196 27956010 1aa932a thinlto+trim_defconfig/vmlinux > > 16347062 11043384 502499 27892945 1a99cd1 gc+thinlto_defconfig/vmlinux > > 15759453 10532792 502395 26794640 198da90 gc+thinlto+trim_defconfig/vmlinux > > > > Thanks for the numbers. > Does CONFIG_TRIM_UNUSED_KSYMS=y have an impact to the build-time (and > disc-usage - negative way means longer/bigger)? > Do you have any build-time for the above numbers? They are in the mailing list archive I linked to: ==== defconfig ==== 332.001786355 seconds time elapsed 8599.464163000 seconds user 676.919635000 seconds sys ==== trim_defconfig ==== 448.378576012 seconds time elapsed 10735.489271000 seconds user 964.006504000 seconds sys ==== gc_defconfig ==== 324.347492236 seconds time elapsed 8465.785800000 seconds user 614.899797000 seconds sys ==== gc+trim_defconfig ==== 429.188875620 seconds time elapsed 10203.759658000 seconds user 871.307973000 seconds sys ==== thinlto_defconfig ==== 389.793540200 seconds time elapsed 9491.665320000 seconds user 664.858109000 seconds sys ==== thinlto+trim_defconfig ==== 580.431820561 seconds time elapsed 11429.515538000 seconds user 1056.985745000 seconds sys ==== gc+thinlto_defconfig ==== 389.484364525 seconds time elapsed 9473.831980000 seconds user 675.057675000 seconds sys ==== gc+thinlto+trim_defconfig ==== 580.824912807 seconds time elapsed 11433.650337000 seconds user 1049.845569000 seconds sys So HAVE_LD_DEAD_CODE_DATA_ELIMINATION is a small improvement on build time (since it can spend less time linking), while CONFIG_TRIM_UNUSED_KSYMS slows it down quite a bit. Combining CONFIG_TRIM_UNUSED_KSYMS with CONFIG_THINLTO is really slow because here most of the time is spent in the final link (especially when you have many CPU cores to do the earlier bits quickly), but then it does the link twice. > BTW, is CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y setable for x86 (64bit)? > ( Did not look or check for it. ) No, in mainline, HAVE_LD_DEAD_CODE_DATA_ELIMINATION is currently only selected on MIPS and PowerPC. I only sent experimental patches to enable it on arm64 and m68k, but have not tried booting them. If you select the symbol on x86, you should see similar results. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel