linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm:free_initrd_mem should also free the memblock
@ 2014-09-12 10:05 Wang, Yalin
  2014-09-15  2:29 ` [PATCH] arm:extend __init_end to a page align address Wang, Yalin
  0 siblings, 1 reply; 5+ messages in thread
From: Wang, Yalin @ 2014-09-12 10:05 UTC (permalink / raw)
  To: 'Will Deacon', 'linux@arm.linux.org.uk',
	'linux-kernel@vger.kernel.org',
	'linux-arm-kernel@lists.infradead.org',
	'linux-mm@kvack.org'

this patch fix the memblock statics for memblock
in file /sys/kernel/debug/memblock/reserved
if we don't call memblock_free the initrd will still
be marked as reserved, even they are freed.

Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
---
 arch/arm/mm/init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 659c75d..7bc8e5b 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -638,6 +638,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 	if (!keep_initrd) {
 		poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
 		free_reserved_area((void *)start, (void *)end, -1, "initrd");
+		memblock_free(__pa(start), end - start);
 	}
 }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] arm:extend __init_end to a page align address
  2014-09-12 10:05 [PATCH] arm:free_initrd_mem should also free the memblock Wang, Yalin
@ 2014-09-15  2:29 ` Wang, Yalin
  2014-09-15 10:26   ` [RFC Resend] " Wang, Yalin
  0 siblings, 1 reply; 5+ messages in thread
From: Wang, Yalin @ 2014-09-15  2:29 UTC (permalink / raw)
  To: 'Will Deacon', 'linux@arm.linux.org.uk',
	'linux-kernel@vger.kernel.org',
	'linux-arm-kernel@lists.infradead.org',
	'linux-mm@kvack.org'

this patch change the __init_end address to a
page align address, so that free_initmem() can
free the whole .init section, because if the end
address is not page aligned, it will round down to
a page align address, then the tail unligned page
will not be freed.

Signed-off-by: wang <yalin.wang2010@gmail.com>
---
 arch/arm/kernel/vmlinux.lds.S   | 2 +-
 arch/arm64/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 6f57cb9..8e95aa4 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -219,8 +219,8 @@ SECTIONS
 	__data_loc = ALIGN(4);		/* location in binary */
 	. = PAGE_OFFSET + TEXT_OFFSET;
 #else
-	__init_end = .;
 	. = ALIGN(THREAD_SIZE);
+	__init_end = .;
 	__data_loc = .;
 #endif
 
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 97f0c04..edf8715 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -97,9 +97,9 @@ SECTIONS
 
 	PERCPU_SECTION(64)
 
+	. = ALIGN(PAGE_SIZE);
 	__init_end = .;
 
-	. = ALIGN(PAGE_SIZE);
 	_data = .;
 	_sdata = .;
 	RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
-- 
1.9.2.msysgit.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC Resend] arm:extend __init_end to a page align address
  2014-09-15  2:29 ` [PATCH] arm:extend __init_end to a page align address Wang, Yalin
@ 2014-09-15 10:26   ` Wang, Yalin
  2014-09-15 10:55     ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: Wang, Yalin @ 2014-09-15 10:26 UTC (permalink / raw)
  To: 'Will Deacon', 'linux-kernel@vger.kernel.org',
	'linux-arm-kernel@lists.infradead.org',
	'linux-mm@kvack.org', 'Russell King - ARM Linux'

this patch change the __init_end address to a page align address, so that free_initmem()
can free the whole .init section, because if the end address is not page aligned,
it will round down to a page align address, then the tail unligned page will not be freed.

Signed-off-by: Yalin wang <yalin.wang@sonymobile.com>
---
 arch/arm/kernel/vmlinux.lds.S   | 2 +-
 arch/arm64/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 6f57cb9..8e95aa4 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -219,8 +219,8 @@ SECTIONS
 	__data_loc = ALIGN(4);		/* location in binary */
 	. = PAGE_OFFSET + TEXT_OFFSET;
 #else
-	__init_end = .;
 	. = ALIGN(THREAD_SIZE);
+	__init_end = .;
 	__data_loc = .;
 #endif
 
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 97f0c04..edf8715 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -97,9 +97,9 @@ SECTIONS
 
 	PERCPU_SECTION(64)
 
+	. = ALIGN(PAGE_SIZE);
 	__init_end = .;
 
-	. = ALIGN(PAGE_SIZE);
 	_data = .;
 	_sdata = .;
 	RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
--
1.9.2.msysgit.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC Resend] arm:extend __init_end to a page align address
  2014-09-15 10:26   ` [RFC Resend] " Wang, Yalin
@ 2014-09-15 10:55     ` Russell King - ARM Linux
  2014-09-15 13:15       ` Catalin Marinas
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2014-09-15 10:55 UTC (permalink / raw)
  To: Wang, Yalin, Jiang Liu
  Cc: 'Will Deacon', 'linux-kernel@vger.kernel.org',
	'linux-arm-kernel@lists.infradead.org',
	'linux-mm@kvack.org'

On Mon, Sep 15, 2014 at 06:26:43PM +0800, Wang, Yalin wrote:
> this patch change the __init_end address to a page align address, so that free_initmem()
> can free the whole .init section, because if the end address is not page aligned,
> it will round down to a page align address, then the tail unligned page will not be freed.

Please wrap commit messages at or before column 72 - this makes "git log"
much easier to read once the change has been committed.

I have no objection to the arch/arm part of this patch.  However, since
different people deal with arch/arm and arch/arm64, this patch needs to
be split.

Also, it may be worth patching include/asm-generic/vmlinux.lds.h to
indicate that __initrd_end should be page aligned - this seems to be a
requirement by the (new-ish) free_reserved_area() function, otherwise
it does indeed round down.

(Added Jiang Liu as the person responsible for free_reserved_area() for
any further comments.)

> 
> Signed-off-by: Yalin wang <yalin.wang@sonymobile.com>
> ---
>  arch/arm/kernel/vmlinux.lds.S   | 2 +-
>  arch/arm64/kernel/vmlinux.lds.S | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 6f57cb9..8e95aa4 100644
> --- a/arch/arm/kernel/vmlinux.lds.S
> +++ b/arch/arm/kernel/vmlinux.lds.S
> @@ -219,8 +219,8 @@ SECTIONS
>  	__data_loc = ALIGN(4);		/* location in binary */
>  	. = PAGE_OFFSET + TEXT_OFFSET;
>  #else
> -	__init_end = .;
>  	. = ALIGN(THREAD_SIZE);
> +	__init_end = .;
>  	__data_loc = .;
>  #endif
>  
> diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 97f0c04..edf8715 100644
> --- a/arch/arm64/kernel/vmlinux.lds.S
> +++ b/arch/arm64/kernel/vmlinux.lds.S
> @@ -97,9 +97,9 @@ SECTIONS
>  
>  	PERCPU_SECTION(64)
>  
> +	. = ALIGN(PAGE_SIZE);
>  	__init_end = .;
>  
> -	. = ALIGN(PAGE_SIZE);
>  	_data = .;
>  	_sdata = .;
>  	RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
> --
> 1.9.2.msysgit.0

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC Resend] arm:extend __init_end to a page align address
  2014-09-15 10:55     ` Russell King - ARM Linux
@ 2014-09-15 13:15       ` Catalin Marinas
  0 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2014-09-15 13:15 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Wang, Yalin, Jiang Liu, 'linux-mm@kvack.org',
	Will Deacon, 'linux-kernel@vger.kernel.org',
	'linux-arm-kernel@lists.infradead.org'

On Mon, Sep 15, 2014 at 11:55:25AM +0100, Russell King - ARM Linux wrote:
> On Mon, Sep 15, 2014 at 06:26:43PM +0800, Wang, Yalin wrote:
> > this patch change the __init_end address to a page align address, so that free_initmem()
> > can free the whole .init section, because if the end address is not page aligned,
> > it will round down to a page align address, then the tail unligned page will not be freed.
> 
> Please wrap commit messages at or before column 72 - this makes "git log"
> much easier to read once the change has been committed.
> 
> I have no objection to the arch/arm part of this patch.  However, since
> different people deal with arch/arm and arch/arm64, this patch needs to
> be split.

I don't mind how it goes in. If Russell is ok to take the whole patch:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-15 13:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12 10:05 [PATCH] arm:free_initrd_mem should also free the memblock Wang, Yalin
2014-09-15  2:29 ` [PATCH] arm:extend __init_end to a page align address Wang, Yalin
2014-09-15 10:26   ` [RFC Resend] " Wang, Yalin
2014-09-15 10:55     ` Russell King - ARM Linux
2014-09-15 13:15       ` Catalin Marinas

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).