From patchwork Tue Apr 23 03:21:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 162634 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3305539jan; Mon, 22 Apr 2019 20:23:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxngXCvsEo35OAT3qGQCLMVq4ImIYfsvvsbqDXMDtVDK4Vy4uYSGVUae2GNJLp9DHk4h4ZL X-Received: by 2002:a63:550d:: with SMTP id j13mr22611747pgb.18.1555989795470; Mon, 22 Apr 2019 20:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555989795; cv=none; d=google.com; s=arc-20160816; b=OPfk3Q8X4jlitjgAQ5BDZ1C9aXUKXRxLqk6srLGIZuLnoWmNB8KCiDTf1lsPtJOOZM crGMTtIBDcLVvWg44gli7reakGNCRC6HJstRCYVNF1LddXq44F7bogsDzEO5kifRl0WG gtdoqPpX63KOsddhfRAgWDmb9WrhhLVPlLEWKxPXdHofkg8pYbGsGw/t/JYqJpTheqn5 ROIaLDzEODPAPm79BVlHQrITBwyN2KOQQcb2s4IDSCvcHtJ6iJgsf69v8rYIn34ybydT Mj7j8I6PRWWok1gyovHUD3qVlbn2lcjKCCa3hQcZ1H9X5iZGXXAwLdHYfVnWL6E8t30T wNEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=YGW0gg01jtKnXbnK1Ap0mVZ9GqJOY8DcvskWgXT4tQY=; b=KYdjAuw8wDB+ctA5/qt+7O8vB6xiBg/XGrN98N9e/SCy/Rf/bSBwXOT6TpuL5+QzSA BSQlofbQI8aBuwbk2AuRtjdfAmKbMr4jsRELVIh9vz2zQF52dHBMGtlakAB1BmfuXUeE P5weE/qRTnNCwVWEr+R8Z2bCgKkpWBQGt4t2ZM+AxKqy11VnbIPR1wuDSrQwaTxIDcAd zo8agdDLS7ZSyBLPKexrxZgCbLmpsnyyUitGi7qzJcDSmqkNJL3KeEIzOFfZ9RO/lHML si2Cn/5wfhkSNAsHbzQ1tIbTTC1NTTXaB1bKZ61h3KEF2SWNAv+a3rC5WkCu1LIKXQUU znkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="mCn02M/+"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si5401588pgi.346.2019.04.22.20.23.15; Mon, 22 Apr 2019 20:23:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="mCn02M/+"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731525AbfDWDXI (ORCPT + 30 others); Mon, 22 Apr 2019 23:23:08 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:58021 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731429AbfDWDW6 (ORCPT ); Mon, 22 Apr 2019 23:22:58 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x3N3L8LL031384; Tue, 23 Apr 2019 12:21:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x3N3L8LL031384 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1555989680; bh=YGW0gg01jtKnXbnK1Ap0mVZ9GqJOY8DcvskWgXT4tQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mCn02M/+Zs1tTrnfj5kcK/rIXu8Qjzpou6KA7O8+YMQxaTRIOmJiYSdn1yiI2naKt MOHV0re8MJvGrURubZ52FRJWYB8BKJDCHdtm0+gi/mtbUq5QKLWZPGOju5xSwUZcWl v62g+gXthE8J+NAD4NPy45+MxSmZ7tonTDzlWDzHGQzYMmZaYvOa54z3WQuT8Zuufn RRLTWAFT4J9sYGariQ0SfM01A/+8PRgOu0jsL4gPe489CoMR6D8YJvBgVXCuHjnXp7 ss+JT31y4kchSzLW7k/zDncSQUjZSSKhKjjg3CKu47It7stLcp72/4twqXDWyaFFPZ vwoBCpY9sZvjQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Andrew Morton , linux-arch Cc: linux-s390@vger.kernel.org, Heiko Carstens , Arnd Bergmann , linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Ingo Molnar , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Christophe Leroy , Mathieu Malaterre , Masahiro Yamada Subject: [PATCH v3 10/10] compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING Date: Tue, 23 Apr 2019 12:21:06 +0900 Message-Id: <20190423032106.11960-11-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190423032106.11960-1-yamada.masahiro@socionext.com> References: <20190423032106.11960-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 60a3cdd06394 ("x86: add optimized inlining") introduced CONFIG_OPTIMIZE_INLINING, but it has been available only for x86. The idea is obviously arch-agnostic. This commit moves the config entry from arch/x86/Kconfig.debug to lib/Kconfig.debug so that all architectures can benefit from it. This can make a huge difference in kernel image size especially when CONFIG_OPTIMIZE_FOR_SIZE is enabled. For example, I got 3.5% smaller arm64 kernel for v5.1-rc1. dec file 18983424 arch/arm64/boot/Image.before 18321920 arch/arm64/boot/Image.after This also slightly improves the "Kernel hacking" Kconfig menu as e61aca5158a8 ("Merge branch 'kconfig-diet' from Dave Hansen') suggested; this config option would be a good fit in the "compiler option" menu. Signed-off-by: Masahiro Yamada Acked-by: Borislav Petkov --- Changes in v3: None Changes in v2: - split into a separate patch arch/x86/Kconfig | 3 --- arch/x86/Kconfig.debug | 14 -------------- include/linux/compiler_types.h | 3 +-- lib/Kconfig.debug | 14 ++++++++++++++ 4 files changed, 15 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 62fc3fda1a05..f214bb5d60d8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -310,9 +310,6 @@ config ZONE_DMA32 config AUDIT_ARCH def_bool y if X86_64 -config ARCH_SUPPORTS_OPTIMIZED_INLINING - def_bool y - config ARCH_SUPPORTS_DEBUG_PAGEALLOC def_bool y diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 15d0fbe27872..f730680dc818 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug @@ -266,20 +266,6 @@ config CPA_DEBUG ---help--- Do change_page_attr() self-tests every 30 seconds. -config OPTIMIZE_INLINING - bool "Allow gcc to uninline functions marked 'inline'" - ---help--- - This option determines if the kernel forces gcc to inline the functions - developers have marked 'inline'. Doing so takes away freedom from gcc to - do what it thinks is best, which is desirable for the gcc 3.x series of - compilers. The gcc 4.x series have a rewritten inlining algorithm and - enabling this option will generate a smaller kernel there. Hopefully - this algorithm is so good that allowing gcc 4.x and above to make the - decision will become the default in the future. Until then this option - is there to test gcc for this. - - If unsure, say N. - config DEBUG_ENTRY bool "Debug low-level entry code" depends on DEBUG_KERNEL diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index ba814f18cb4c..19e58b9138a0 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -140,8 +140,7 @@ struct ftrace_likely_data { * Do not use __always_inline here, since currently it expands to inline again * (which would break users of __always_inline). */ -#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ - !defined(CONFIG_OPTIMIZE_INLINING) +#if !defined(CONFIG_OPTIMIZE_INLINING) #define inline inline __attribute__((__always_inline__)) __gnu_inline \ __maybe_unused notrace #else diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 00dbcdbc9a0d..37402f210115 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -310,6 +310,20 @@ config HEADERS_CHECK exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in your build tree), to make sure they're suitable. +config OPTIMIZE_INLINING + bool "Allow compiler to uninline functions marked 'inline'" + help + This option determines if the kernel forces gcc to inline the functions + developers have marked 'inline'. Doing so takes away freedom from gcc to + do what it thinks is best, which is desirable for the gcc 3.x series of + compilers. The gcc 4.x series have a rewritten inlining algorithm and + enabling this option will generate a smaller kernel there. Hopefully + this algorithm is so good that allowing gcc 4.x and above to make the + decision will become the default in the future. Until then this option + is there to test gcc for this. + + If unsure, say N. + config DEBUG_SECTION_MISMATCH bool "Enable full Section mismatch analysis" help