* [PATCH] arm:extend the reserved mrmory for initrd to be page aligned
@ 2014-09-18 1:58 Wang, Yalin
2014-09-18 5:55 ` Uwe Kleine-König
0 siblings, 1 reply; 4+ messages in thread
From: Wang, Yalin @ 2014-09-18 1:58 UTC (permalink / raw)
To: 'Will Deacon', 'linux-kernel@vger.kernel.org',
'linux-arm-kernel@lists.infradead.org',
'linux-mm@kvack.org',
'linux-arm-msm@vger.kernel.org',
'Russell King - ARM Linux'
this patch extend the start and end address of initrd to be page aligned,
so that we can free all memory including the un-page aligned head or tail
page of initrd, if the start or end address of initrd are not page
aligned, the page can't be freed by free_initrd_mem() function.
Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
---
arch/arm/mm/init.c | 5 +++++
arch/arm64/mm/init.c | 8 +++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 659c75d..9221645 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -636,6 +636,11 @@ static int keep_initrd;
void free_initrd_mem(unsigned long start, unsigned long end)
{
if (!keep_initrd) {
+ if (start == initrd_start)
+ start = round_down(start, PAGE_SIZE);
+ if (end == initrd_end)
+ end = round_up(end, PAGE_SIZE);
+
poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
free_reserved_area((void *)start, (void *)end, -1, "initrd");
}
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 5472c24..c5512f6 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -334,8 +334,14 @@ static int keep_initrd;
void free_initrd_mem(unsigned long start, unsigned long end)
{
- if (!keep_initrd)
+ if (!keep_initrd) {
+ if (start == initrd_start)
+ start = round_down(start, PAGE_SIZE);
+ if (end == initrd_end)
+ end = round_up(end, PAGE_SIZE);
+
free_reserved_area((void *)start, (void *)end, 0, "initrd");
+ }
}
static int __init keepinitrd_setup(char *__unused)
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arm:extend the reserved mrmory for initrd to be page aligned
2014-09-18 1:58 [PATCH] arm:extend the reserved mrmory for initrd to be page aligned Wang, Yalin
@ 2014-09-18 5:55 ` Uwe Kleine-König
2014-09-18 6:53 ` [PATCH Resend] " Wang, Yalin
0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2014-09-18 5:55 UTC (permalink / raw)
To: Wang, Yalin
Cc: 'Will Deacon', 'linux-kernel@vger.kernel.org',
'linux-arm-kernel@lists.infradead.org',
'linux-mm@kvack.org',
'linux-arm-msm@vger.kernel.org',
'Russell King - ARM Linux'
Hello,
just some commit log nit picking:
$Subject ~= s/mrmory/memory/
And also "ARM: " is the more typical prefix. Don't know if there is a
best practice for patches touching both arm and arm64. (But assuming
this will go through Russell's patch tracker this doesn't matter much.)
On Thu, Sep 18, 2014 at 09:58:10AM +0800, Wang, Yalin wrote:
> this patch extend the start and end address of initrd to be page aligned,
This patch extends ...
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH Resend] arm:extend the reserved mrmory for initrd to be page aligned
2014-09-18 5:55 ` Uwe Kleine-König
@ 2014-09-18 6:53 ` Wang, Yalin
2014-09-18 16:04 ` Catalin Marinas
0 siblings, 1 reply; 4+ messages in thread
From: Wang, Yalin @ 2014-09-18 6:53 UTC (permalink / raw)
To: 'Uwe Kleine-König'
Cc: 'Will Deacon', 'linux-kernel@vger.kernel.org',
'linux-arm-kernel@lists.infradead.org',
'linux-mm@kvack.org',
'linux-arm-msm@vger.kernel.org',
'Russell King - ARM Linux'
This patch extends the start and end address of initrd to be page aligned,
so that we can free all memory including the un-page aligned head or tail
page of initrd, if the start or end address of initrd are not page
aligned, the page can't be freed by free_initrd_mem() function.
Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
---
arch/arm/mm/init.c | 5 +++++
arch/arm64/mm/init.c | 8 +++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 659c75d..9221645 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -636,6 +636,11 @@ static int keep_initrd;
void free_initrd_mem(unsigned long start, unsigned long end)
{
if (!keep_initrd) {
+ if (start == initrd_start)
+ start = round_down(start, PAGE_SIZE);
+ if (end == initrd_end)
+ end = round_up(end, PAGE_SIZE);
+
poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
free_reserved_area((void *)start, (void *)end, -1, "initrd");
}
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 5472c24..c5512f6 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -334,8 +334,14 @@ static int keep_initrd;
void free_initrd_mem(unsigned long start, unsigned long end)
{
- if (!keep_initrd)
+ if (!keep_initrd) {
+ if (start == initrd_start)
+ start = round_down(start, PAGE_SIZE);
+ if (end == initrd_end)
+ end = round_up(end, PAGE_SIZE);
+
free_reserved_area((void *)start, (void *)end, 0, "initrd");
+ }
}
static int __init keepinitrd_setup(char *__unused)
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH Resend] arm:extend the reserved mrmory for initrd to be page aligned
2014-09-18 6:53 ` [PATCH Resend] " Wang, Yalin
@ 2014-09-18 16:04 ` Catalin Marinas
0 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2014-09-18 16:04 UTC (permalink / raw)
To: Wang, Yalin
Cc: 'Uwe Kleine-König',
'Russell King - ARM Linux',
'linux-arm-msm@vger.kernel.org',
Will Deacon, 'linux-kernel@vger.kernel.org',
'linux-mm@kvack.org',
'linux-arm-kernel@lists.infradead.org'
On Thu, Sep 18, 2014 at 07:53:57AM +0100, Wang, Yalin wrote:
> This patch extends the start and end address of initrd to be page aligned,
> so that we can free all memory including the un-page aligned head or tail
> page of initrd, if the start or end address of initrd are not page
> aligned, the page can't be freed by free_initrd_mem() function.
>
> Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
You still have a typo in the subject.
For the arm64 part:
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
so you can merge it via Russell's patch system.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-18 16:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18 1:58 [PATCH] arm:extend the reserved mrmory for initrd to be page aligned Wang, Yalin
2014-09-18 5:55 ` Uwe Kleine-König
2014-09-18 6:53 ` [PATCH Resend] " Wang, Yalin
2014-09-18 16:04 ` 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).