linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: yalin wang <yalin.wang2010@gmail.com>
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	[thread overview]
Message-ID: <1444622356-8263-1-git-send-email-yalin.wang2010@gmail.com> (raw)

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 <yalin.wang2010@gmail.com>
---
 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 <linux/resource.h>
 #include <linux/page_ext.h>
 #include <linux/err.h>
+#include <asm/sections.h>
 
 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)
-- 
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2015-10-12  4:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12  3:59 yalin wang [this message]
2015-10-12  8:22 ` [RFC] arm: add __initbss section attribute Ard Biesheuvel
2015-10-12  8:46   ` yalin wang
2015-10-12 10:21 ` Arnd Bergmann
2015-10-12 20:04 ` Sam Ravnborg
2015-10-13  7:33   ` yalin wang
2015-10-13  9:40     ` Arnd Bergmann
2015-10-13  9:51       ` yalin wang
2015-10-13 11:28         ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444622356-8263-1-git-send-email-yalin.wang2010@gmail.com \
    --to=yalin.wang2010@gmail.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=ggdavisiv@gmail.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jack@suse.cz \
    --cc=keescook@chromium.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mcgrof@suse.com \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=msalter@redhat.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=nico@linaro.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=rusty@rustcorp.com.au \
    --cc=vbabka@suse.cz \
    --cc=victor.kamensky@linaro.org \
    --cc=vladimir.murzin@arm.com \
    --cc=will.deacon@arm.com \
    --cc=xiexiuqi@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).