LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/1] arm64: To remove initrd reserved area entry from memblock
       [not found] <CGME20180406045340epcas1p1ae6416dc25823212303c9109d125c018@epcas1p1.samsung.com>
@ 2018-04-06  4:53 ` CHANDAN VN
  2018-04-06 16:17   ` Laura Abbott
       [not found]   ` <CGME20180430042028epcas2p24418c10ebe7b2c656cdfc31e98ed540b@epcas2p2.samsung.com>
  0 siblings, 2 replies; 7+ messages in thread
From: CHANDAN VN @ 2018-04-06  4:53 UTC (permalink / raw)
  To: catalin.marinas, will.deacon, takahiro.akashi, james.morse,
	robin.murphy, labbott, steve.capper, kristina.martsenko,
	linux-arm-kernel, linux-kernel
  Cc: cpgs, chandan.vn, vn.chandan

INITRD reserved area entry is not removed from memblock
even though initrd reserved area is freed. After freeing
the memory it is released from memblock. The same can be
checked from /sys/kernel/debug/memblock/reserved.

The patch makes sure that the initrd entry is removed from
memblock when keepinitrd is not enabled.

Signed-off-by: CHANDAN VN <chandan.vn@samsung.com>
---
 arch/arm64/mm/init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 9f3c47a..1b18b47 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -646,8 +646,10 @@ void free_initmem(void)
 
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
-	if (!keep_initrd)
+	if (!keep_initrd) {
 		free_reserved_area((void *)start, (void *)end, 0, "initrd");
+		memblock_free(__virt_to_phys(start), end - start);
+	}
 }
 
 static int __init keepinitrd_setup(char *__unused)
-- 
1.9.1

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

* Re: [PATCH 1/1] arm64: To remove initrd reserved area entry from memblock
  2018-04-06  4:53 ` [PATCH 1/1] arm64: To remove initrd reserved area entry from memblock CHANDAN VN
@ 2018-04-06 16:17   ` Laura Abbott
  2018-04-07  4:28     ` Chandan Vn
       [not found]   ` <CGME20180430042028epcas2p24418c10ebe7b2c656cdfc31e98ed540b@epcas2p2.samsung.com>
  1 sibling, 1 reply; 7+ messages in thread
From: Laura Abbott @ 2018-04-06 16:17 UTC (permalink / raw)
  To: CHANDAN VN, catalin.marinas, will.deacon, takahiro.akashi,
	james.morse, robin.murphy, steve.capper, kristina.martsenko,
	linux-arm-kernel, linux-kernel
  Cc: cpgs, vn.chandan

On 04/05/2018 09:53 PM, CHANDAN VN wrote:
> INITRD reserved area entry is not removed from memblock
> even though initrd reserved area is freed. After freeing
> the memory it is released from memblock. The same can be
> checked from /sys/kernel/debug/memblock/reserved.
> 
> The patch makes sure that the initrd entry is removed from
> memblock when keepinitrd is not enabled.
> 

Does this have an impact on anything besides accounting
in memblock?

> Signed-off-by: CHANDAN VN <chandan.vn@samsung.com>
> ---
>   arch/arm64/mm/init.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 9f3c47a..1b18b47 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -646,8 +646,10 @@ void free_initmem(void)
>   
>   void __init free_initrd_mem(unsigned long start, unsigned long end)
>   {
> -	if (!keep_initrd)
> +	if (!keep_initrd) {
>   		free_reserved_area((void *)start, (void *)end, 0, "initrd");
> +		memblock_free(__virt_to_phys(start), end - start);
> +	}
>   }
>   
>   static int __init keepinitrd_setup(char *__unused)
> 

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

* Re: [PATCH 1/1] arm64: To remove initrd reserved area entry from memblock
  2018-04-06 16:17   ` Laura Abbott
@ 2018-04-07  4:28     ` Chandan Vn
  2018-04-23  5:00       ` Chandan Vn
  0 siblings, 1 reply; 7+ messages in thread
From: Chandan Vn @ 2018-04-07  4:28 UTC (permalink / raw)
  To: Laura Abbott
  Cc: CHANDAN VN, catalin.marinas, will.deacon, takahiro.akashi,
	james.morse, robin.murphy, steve.capper, kristina.martsenko,
	linux-arm-kernel, linux-kernel, cpgs

On Fri, Apr 6, 2018 at 9:47 PM, Laura Abbott <labbott@redhat.com> wrote:
> Does this have an impact on anything besides accounting
> in memblock?

Yes, the impact is only on accounting or debugging.

We were trying to reduce the reserved memory by removing initrd reserved area.
After disabling "keepinitrd", only way to check if it was removed or
not was to check
/sys/kernel/debug/memblock/reserved. We found the entry to be present
irrespective of
"keepinitrd" being enabled/disabled.
I hope that with the fix others wont face similar issue. Also we did
not find any such problem
with ARM32 ARCHITECTURE.

On Fri, Apr 6, 2018 at 9:47 PM, Laura Abbott <labbott@redhat.com> wrote:
> On 04/05/2018 09:53 PM, CHANDAN VN wrote:
>>
>> INITRD reserved area entry is not removed from memblock
>> even though initrd reserved area is freed. After freeing
>> the memory it is released from memblock. The same can be
>> checked from /sys/kernel/debug/memblock/reserved.
>>
>> The patch makes sure that the initrd entry is removed from
>> memblock when keepinitrd is not enabled.
>>
>
> Does this have an impact on anything besides accounting
> in memblock?
>
>
>> Signed-off-by: CHANDAN VN <chandan.vn@samsung.com>
>> ---
>>   arch/arm64/mm/init.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>> index 9f3c47a..1b18b47 100644
>> --- a/arch/arm64/mm/init.c
>> +++ b/arch/arm64/mm/init.c
>> @@ -646,8 +646,10 @@ void free_initmem(void)
>>     void __init free_initrd_mem(unsigned long start, unsigned long end)
>>   {
>> -       if (!keep_initrd)
>> +       if (!keep_initrd) {
>>                 free_reserved_area((void *)start, (void *)end, 0,
>> "initrd");
>> +               memblock_free(__virt_to_phys(start), end - start);
>> +       }
>>   }
>>     static int __init keepinitrd_setup(char *__unused)
>>
>

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

* Re: [PATCH 1/1] arm64: To remove initrd reserved area entry from memblock
  2018-04-07  4:28     ` Chandan Vn
@ 2018-04-23  5:00       ` Chandan Vn
  2018-04-27 16:55         ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Chandan Vn @ 2018-04-23  5:00 UTC (permalink / raw)
  To: Laura Abbott
  Cc: CHANDAN VN, catalin.marinas, will.deacon, Takahiro Akashi,
	james.morse, robin.murphy, steve.capper, kristina.martsenko,
	linux-arm-kernel, linux-kernel, cpgs

Hi,

May I know when this patch would be taken for merging?


On Sat, Apr 7, 2018 at 9:58 AM, Chandan Vn <vn.chandan@gmail.com> wrote:
> On Fri, Apr 6, 2018 at 9:47 PM, Laura Abbott <labbott@redhat.com> wrote:
>> Does this have an impact on anything besides accounting
>> in memblock?
>
> Yes, the impact is only on accounting or debugging.
>
> We were trying to reduce the reserved memory by removing initrd reserved area.
> After disabling "keepinitrd", only way to check if it was removed or
> not was to check
> /sys/kernel/debug/memblock/reserved. We found the entry to be present
> irrespective of
> "keepinitrd" being enabled/disabled.
> I hope that with the fix others wont face similar issue. Also we did
> not find any such problem
> with ARM32 ARCHITECTURE.
>
> On Fri, Apr 6, 2018 at 9:47 PM, Laura Abbott <labbott@redhat.com> wrote:
>> On 04/05/2018 09:53 PM, CHANDAN VN wrote:
>>>
>>> INITRD reserved area entry is not removed from memblock
>>> even though initrd reserved area is freed. After freeing
>>> the memory it is released from memblock. The same can be
>>> checked from /sys/kernel/debug/memblock/reserved.
>>>
>>> The patch makes sure that the initrd entry is removed from
>>> memblock when keepinitrd is not enabled.
>>>
>>
>> Does this have an impact on anything besides accounting
>> in memblock?
>>
>>
>>> Signed-off-by: CHANDAN VN <chandan.vn@samsung.com>
>>> ---
>>>   arch/arm64/mm/init.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>>> index 9f3c47a..1b18b47 100644
>>> --- a/arch/arm64/mm/init.c
>>> +++ b/arch/arm64/mm/init.c
>>> @@ -646,8 +646,10 @@ void free_initmem(void)
>>>     void __init free_initrd_mem(unsigned long start, unsigned long end)
>>>   {
>>> -       if (!keep_initrd)
>>> +       if (!keep_initrd) {
>>>                 free_reserved_area((void *)start, (void *)end, 0,
>>> "initrd");
>>> +               memblock_free(__virt_to_phys(start), end - start);
>>> +       }
>>>   }
>>>     static int __init keepinitrd_setup(char *__unused)
>>>
>>

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

* Re: [PATCH 1/1] arm64: To remove initrd reserved area entry from memblock
  2018-04-23  5:00       ` Chandan Vn
@ 2018-04-27 16:55         ` Will Deacon
  0 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2018-04-27 16:55 UTC (permalink / raw)
  To: Chandan Vn
  Cc: Laura Abbott, CHANDAN VN, catalin.marinas, Takahiro Akashi,
	james.morse, robin.murphy, steve.capper, kristina.martsenko,
	linux-arm-kernel, linux-kernel, cpgs

On Mon, Apr 23, 2018 at 10:30:49AM +0530, Chandan Vn wrote:
> May I know when this patch would be taken for merging?

Please can you send a new version, stating in the commit message that
this only affects accountinga and debugging, rather than plugging an
actual memory leak?

Cheers,

Will

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

* [PATCHv2 1/1] arm64: To remove initrd reserved area entry from memblock
       [not found]   ` <CGME20180430042028epcas2p24418c10ebe7b2c656cdfc31e98ed540b@epcas2p2.samsung.com>
@ 2018-04-30  4:20     ` CHANDAN VN
  2018-04-30 17:21       ` Laura Abbott
  0 siblings, 1 reply; 7+ messages in thread
From: CHANDAN VN @ 2018-04-30  4:20 UTC (permalink / raw)
  To: catalin.marinas, will.deacon, takahiro.akashi, james.morse,
	robin.murphy, labbott, steve.capper, kristina.martsenko,
	linux-arm-kernel, linux-kernel
  Cc: cpgs, chandan.vn, vn.chandan

INITRD reserved area entry is not removed from memblock
even though initrd reserved area is freed. After freeing
the memory it is released from memblock. The same can be
checked from /sys/kernel/debug/memblock/reserved.

The patch makes sure that the initrd entry is removed from
memblock when keepinitrd is not enabled.

The patch only affects accounting and debugging. This does not
fix any memory leak.

Signed-off-by: CHANDAN VN <chandan.vn@samsung.com>
---
 arch/arm64/mm/init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 9f3c47a..1b18b47 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -646,8 +646,10 @@ void free_initmem(void)
 
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
-	if (!keep_initrd)
+	if (!keep_initrd) {
 		free_reserved_area((void *)start, (void *)end, 0, "initrd");
+		memblock_free(__virt_to_phys(start), end - start);
+	}
 }
 
 static int __init keepinitrd_setup(char *__unused)
-- 
1.9.1

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

* Re: [PATCHv2 1/1] arm64: To remove initrd reserved area entry from memblock
  2018-04-30  4:20     ` [PATCHv2 " CHANDAN VN
@ 2018-04-30 17:21       ` Laura Abbott
  0 siblings, 0 replies; 7+ messages in thread
From: Laura Abbott @ 2018-04-30 17:21 UTC (permalink / raw)
  To: CHANDAN VN, catalin.marinas, will.deacon, takahiro.akashi,
	james.morse, robin.murphy, steve.capper, kristina.martsenko,
	linux-arm-kernel, linux-kernel
  Cc: cpgs, vn.chandan

On 04/29/2018 09:20 PM, CHANDAN VN wrote:
> INITRD reserved area entry is not removed from memblock
> even though initrd reserved area is freed. After freeing
> the memory it is released from memblock. The same can be
> checked from /sys/kernel/debug/memblock/reserved.
> 
> The patch makes sure that the initrd entry is removed from
> memblock when keepinitrd is not enabled.
> 
> The patch only affects accounting and debugging. This does not
> fix any memory leak.
> 
> Signed-off-by: CHANDAN VN <chandan.vn@samsung.com>
> ---
>   arch/arm64/mm/init.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 9f3c47a..1b18b47 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -646,8 +646,10 @@ void free_initmem(void)
>   
>   void __init free_initrd_mem(unsigned long start, unsigned long end)
>   {
> -	if (!keep_initrd)
> +	if (!keep_initrd) {
>   		free_reserved_area((void *)start, (void *)end, 0, "initrd");
> +		memblock_free(__virt_to_phys(start), end - start);
> +	}
>   }
>   
>   static int __init keepinitrd_setup(char *__unused)
> 

Acked-by: Laura Abbott <labbott@redhat.com>

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

end of thread, other threads:[~2018-04-30 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180406045340epcas1p1ae6416dc25823212303c9109d125c018@epcas1p1.samsung.com>
2018-04-06  4:53 ` [PATCH 1/1] arm64: To remove initrd reserved area entry from memblock CHANDAN VN
2018-04-06 16:17   ` Laura Abbott
2018-04-07  4:28     ` Chandan Vn
2018-04-23  5:00       ` Chandan Vn
2018-04-27 16:55         ` Will Deacon
     [not found]   ` <CGME20180430042028epcas2p24418c10ebe7b2c656cdfc31e98ed540b@epcas2p2.samsung.com>
2018-04-30  4:20     ` [PATCHv2 " CHANDAN VN
2018-04-30 17:21       ` Laura Abbott

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