From patchwork Mon Oct 12 03:59:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yalin wang X-Patchwork-Id: 7372041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CAC349F37F for ; Mon, 12 Oct 2015 04:02:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDC2620958 for ; Mon, 12 Oct 2015 04:02:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEFBF20957 for ; Mon, 12 Oct 2015 04:02:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZlUIE-0004sd-5M; Mon, 12 Oct 2015 04:00:58 +0000 Received: from mail-pa0-x243.google.com ([2607:f8b0:400e:c03::243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZlUIA-0004nl-96 for linux-arm-kernel@lists.infradead.org; Mon, 12 Oct 2015 04:00:54 +0000 Received: by pablk4 with SMTP id lk4so17663374pab.1 for ; Sun, 11 Oct 2015 21:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=FaM7A/ReCnrcnvNul6v6Aq0BA5aB2g4RI7wdoYcVpsM=; b=Hm47CZgccd5/b54QwqP60yckdayq6nygTi1rIz8d6ArrqXF7AA62ElvpLSuIP5S4CK IinKjR4IpfDoKcd0jetPLkzolH6rbnJlN63ppwt53ZghLEGiE0xxVQHNN86RjZWc8zsX T9m6wOl4zzTQ2KVXPezf52e02XGIUcve9ZbW+UmcmKKO4zC02ghH0JahxxIOAi2gIoEu tImDjLnFC9W7v6+SRw9Tz002wUcW3SSaqHe9N4ieBI6U9ibr1NypXiolStsDY5+Ecrj7 I/1chpJ09DQbxh6hMQrK4aiVndm1Ga3FIXR/zoqwb+rQmYmWhMSK7Z1fcnPjOXHsWjT8 gzsg== X-Received: by 10.66.131.81 with SMTP id ok17mr31323278pab.150.1444622433619; Sun, 11 Oct 2015 21:00:33 -0700 (PDT) Received: from ubuntu.localdomain ([17.87.20.100]) by smtp.googlemail.com with ESMTPSA id tj2sm15362659pab.4.2015.10.11.21.00.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 Oct 2015 21:00:32 -0700 (PDT) From: yalin wang To: linux@arm.linux.org.uk, arnd@arndb.de, ard.biesheuvel@linaro.org, will.deacon@arm.com, nico@linaro.org, keescook@chromium.org, yalin.wang2010@gmail.com, catalin.marinas@arm.com, victor.kamensky@linaro.org, msalter@redhat.com, vladimir.murzin@arm.com, ggdavisiv@gmail.com, paul.gortmaker@windriver.com, mingo@kernel.org, rusty@rustcorp.com.au, mcgrof@suse.com, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, n-horiguchi@ah.jp.nec.com, aarcange@redhat.com, mhocko@suse.com, jack@suse.cz, iamjoonsoo.kim@lge.com, xiexiuqi@huawei.com, vbabka@suse.cz, Vineet.Gupta1@synopsys.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: [RFC] arm: add __initbss section attribute Date: Mon, 12 Oct 2015 11:59:16 +0800 Message-Id: <1444622356-8263-1-git-send-email-yalin.wang2010@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151011_210054_351514_A112ABA5 X-CRM114-Status: GOOD ( 13.63 ) X-Spam-Score: -2.5 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This attribute can make init data to be into .initbss section, this will make the data to be NO_BITS in vmlinux, can shrink the Image file size, and speed up the boot up time. Signed-off-by: yalin wang --- arch/arm/kernel/vmlinux.lds.S | 2 +- arch/arm/mm/init.c | 1 + include/asm-generic/sections.h | 1 + include/asm-generic/vmlinux.lds.h | 11 ++++++++++- include/linux/init.h | 1 + include/linux/mm.h | 4 +++- 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 8b60fde..ad6d740 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -330,7 +330,7 @@ SECTIONS } #endif - BSS_SECTION(0, 0, 0) + BSS_SECTION(0, 0, 0, 0) _end = .; STABS_DEBUG diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 8a63b4c..50b881e 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -722,6 +722,7 @@ void free_initmem(void) free_tcmmem(); poison_init_mem(__init_begin, __init_end - __init_begin); + poison_init_mem(__initbss_start, __initbss_start - __initbss_end); if (!machine_is_integrator() && !machine_is_cintegrator()) free_initmem_default(-1); } diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index b58fd66..a63ebe9 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -29,6 +29,7 @@ extern char _text[], _stext[], _etext[]; extern char _data[], _sdata[], _edata[]; extern char __bss_start[], __bss_stop[]; extern char __init_begin[], __init_end[]; +extern char __initbss_start[], __initbss_end[]; extern char _sinittext[], _einittext[]; extern char _end[]; extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index c4bd0e2..b3db62d 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -574,6 +574,14 @@ *(COMMON) \ } +#define INITBSS(initbss_align) \ + . = ALIGN(initbss_align); \ + .initbss : AT(ADDR(.initbss) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__initbss_start) = .; \ + *(.bss.init.data) \ + VMLINUX_SYMBOL(__initbss_end) = .; \ + } + /* * DWARF debug sections. * Symbols in the DWARF debugging sections are relative to @@ -831,10 +839,11 @@ INIT_RAM_FS \ } -#define BSS_SECTION(sbss_align, bss_align, stop_align) \ +#define BSS_SECTION(sbss_align, bss_align, initbss_align, stop_align) \ . = ALIGN(sbss_align); \ VMLINUX_SYMBOL(__bss_start) = .; \ SBSS(sbss_align) \ BSS(bss_align) \ + INITBSS(initbss_align) \ . = ALIGN(stop_align); \ VMLINUX_SYMBOL(__bss_stop) = .; diff --git a/include/linux/init.h b/include/linux/init.h index b449f37..f2960b2 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -41,6 +41,7 @@ discard it in modules) */ #define __init __section(.init.text) __cold notrace #define __initdata __section(.init.data) +#define __initbss __section(.bss.init.data) #define __initconst __constsection(.init.rodata) #define __exitdata __section(.exit.data) #define __exit_call __used __section(.exitcall.exit) diff --git a/include/linux/mm.h b/include/linux/mm.h index d30eea3..1f266f7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -21,6 +21,7 @@ #include #include #include +#include struct mempolicy; struct anon_vma; @@ -1722,10 +1723,11 @@ static inline void mark_page_reserved(struct page *page) */ static inline unsigned long free_initmem_default(int poison) { - extern char __init_begin[], __init_end[]; return free_reserved_area(&__init_begin, &__init_end, poison, "unused kernel"); + return free_reserved_area(&__initbss_start, &__initbss_end, + poison, "unused kernel"); } static inline unsigned long get_num_physpages(void)