Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp927683ybt; Wed, 24 Jun 2020 15:04:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMhvbE4K5ioD5L81SccdRGxMlNnSA7cEb/UdzFTRFVttrOmqhL706WVr4G3GXiFUu2X2ze X-Received: by 2002:a17:906:3c10:: with SMTP id h16mr21211789ejg.87.1593036277116; Wed, 24 Jun 2020 15:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593036277; cv=none; d=google.com; s=arc-20160816; b=YzNLBkx1Cvmj6E4QSQPbxtSlaL3VOwjfv5HKN/UnOsf3PoCUr8iUPQ6VR2y4FBZ8nn hoWIrTKNCQkxWXUrMiHhlo1oat2ozifPl5aCkolaoKzhFB9R6BnRnqFSVxA72a+sMX82 k8Euucxm35usLU3k8HL3JY/NATbqerOQi9zMMx78E9Q7xyp4tIjCqBuQvKEngLXc81om 0OR5fBBp3ItvDAxLahk18EnqfZmelpcqlrIwjwnoW3VIouan7lfv22ulRXUwV415co37 mpjoxeahc0Xu+a1oySK93kbi7Mvv54JjccYO+cLmjaOrcqgknKAUXbcSevr/ITeSgxVd 5RSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=jL5/nBQ2OUP0iahePtvie+O7JpbFb9Sg2cWrP7q25CU=; b=ct1XKsA6fITOvSvVMnWkUzzZC+CNzxbw4ToKC7q0yE1wlUk95zuOx/rZsNxdqNH9VP 6CrmzAzJcQ0Y0pvijkkAvXrGVue5pTnunvcRa3DfW/LNAPxD8/k/7XPluek3JZk+WTZB EEL05cbi0DCQ50DqwbmIY2pFpYzLorIohcuugkYzpIHEBUGN83SMlrydlqN1wRSwPKg9 FvgwziwBIDuv5UEaR5EIUyCR+Lpupqc45hx6b82FY3f/bfipJDoJU1mgkTsq/kmi04ku 3AuNwx7nL/goqrGePfbaZUBmavXkXLv5QKGzood8poJrx15UypMPXlECld5JfIZstd7h WkWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b="tCg/wFYt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a10si588402eju.575.2020.06.24.15.04.14; Wed, 24 Jun 2020 15:04:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b="tCg/wFYt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390619AbgFXVVS (ORCPT + 99 others); Wed, 24 Jun 2020 17:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389773AbgFXVVR (ORCPT ); Wed, 24 Jun 2020 17:21:17 -0400 Received: from casper.infradead.org (unknown [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24D9DC061573; Wed, 24 Jun 2020 14:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jL5/nBQ2OUP0iahePtvie+O7JpbFb9Sg2cWrP7q25CU=; b=tCg/wFYtRwvv+wLp9PXDSfPdmx 05NfkblFR1fTK0rTrKIOXZGlXZ+JCANTa1zrKQbLvzxUN8BLw2M1X+2KYUk3piceBuyoZSqhQIJLX BmiRFl6Mw00wYlENMfdTE5tCN9J+uAiMiMhCC9zMR7poqnCgl97vg6/iexEfNsjUqD7YUz57hK5wa zUbF285iGX8+ETEk4lhuQ53Ajdkurwj1DNy8jcWRRbScXubcskSeUi6aAeV5gqR0NXzuqYeVfjl5W kuvvVNo2h26+DJDawt8+bqb0a15CxZeoBoHxXeE/9SI5cv/tVhPiBJvvk6jL6XXXVfZnkMsujW67G qNdoj+fQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1joCpE-0004cG-FE; Wed, 24 Jun 2020 21:20:57 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0B4FC301A7A; Wed, 24 Jun 2020 23:20:56 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ED0F1203CDC50; Wed, 24 Jun 2020 23:20:55 +0200 (CEST) Date: Wed, 24 Jun 2020 23:20:55 +0200 From: Peter Zijlstra To: Sami Tolvanen Cc: Masahiro Yamada , Will Deacon , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, x86@kernel.org, George Burgess IV Subject: Re: [PATCH 06/22] kbuild: lto: limit inlining Message-ID: <20200624212055.GU4817@hirez.programming.kicks-ass.net> References: <20200624203200.78870-1-samitolvanen@google.com> <20200624203200.78870-7-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624203200.78870-7-samitolvanen@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 01:31:44PM -0700, Sami Tolvanen wrote: > This change limits function inlining across translation unit > boundaries in order to reduce the binary size with LTO. > > The -import-instr-limit flag defines a size limit, as the number > of LLVM IR instructions, for importing functions from other TUs. > The default value is 100, and decreasing it to 5 reduces the size > of a stripped arm64 defconfig vmlinux by 11%. Is that also the right number for x86? What about the effect on performance? What did 6 do? or 4? > Suggested-by: George Burgess IV > Signed-off-by: Sami Tolvanen > --- > Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/Makefile b/Makefile > index 3a7e5e5c17b9..ee66513a5b66 100644 > --- a/Makefile > +++ b/Makefile > @@ -894,6 +894,10 @@ else > CC_FLAGS_LTO_CLANG := -flto > endif > CC_FLAGS_LTO_CLANG += -fvisibility=default > + > +# Limit inlining across translation units to reduce binary size > +LD_FLAGS_LTO_CLANG := -mllvm -import-instr-limit=5 > +KBUILD_LDFLAGS += $(LD_FLAGS_LTO_CLANG) > endif > > ifdef CONFIG_LTO > -- > 2.27.0.212.ge8ba1cc988-goog >