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 <[email protected]>
---
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
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 <[email protected]>
> ---
> 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)
>
On Fri, Apr 6, 2018 at 9:47 PM, Laura Abbott <[email protected]> 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 <[email protected]> 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 <[email protected]>
>> ---
>> 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)
>>
>
Hi,
May I know when this patch would be taken for merging?
On Sat, Apr 7, 2018 at 9:58 AM, Chandan Vn <[email protected]> wrote:
> On Fri, Apr 6, 2018 at 9:47 PM, Laura Abbott <[email protected]> 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 <[email protected]> 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 <[email protected]>
>>> ---
>>> 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)
>>>
>>
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
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 <[email protected]>
---
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
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 <[email protected]>
> ---
> 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 <[email protected]>