All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@lists.ozlabs.org
Cc: Bharata B Rao <bharata@linux.ibm.com>
Subject: Re: [PATCH v2 2/4] powerpc/mm/radix: Free PUD table when freeing pagetable
Date: Wed, 8 Jul 2020 08:18:52 +0530	[thread overview]
Message-ID: <c9572da4-e354-a65f-c332-c11cd043135b@linux.ibm.com> (raw)
In-Reply-To: <87a70a4uw2.fsf@mpe.ellerman.id.au>

On 7/8/20 7:42 AM, Michael Ellerman wrote:
> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>> From: Bharata B Rao <bharata@linux.ibm.com>
>>
>> remove_pagetable() isn't freeing PUD table. This causes memory
>> leak during memory unplug. Fix this.
> 

Fixes: 4b5d62ca17a1 ("powerpc/mm: add radix__remove_section_mapping()")


> Fixes: ??
> 
> cheers
> 
>> Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>>   arch/powerpc/mm/book3s64/radix_pgtable.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
>> index 80be96d3018f..af57604f295f 100644
>> --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
>> +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
>> @@ -708,6 +708,21 @@ static void free_pmd_table(pmd_t *pmd_start, pud_t *pud)
>>   	pud_clear(pud);
>>   }
>>   
>> +static void free_pud_table(pud_t *pud_start, p4d_t *p4d)
>> +{
>> +	pud_t *pud;
>> +	int i;
>> +
>> +	for (i = 0; i < PTRS_PER_PUD; i++) {
>> +		pud = pud_start + i;
>> +		if (!pud_none(*pud))
>> +			return;
>> +	}
>> +
>> +	pud_free(&init_mm, pud_start);
>> +	p4d_clear(p4d);
>> +}
>> +
>>   struct change_mapping_params {
>>   	pte_t *pte;
>>   	unsigned long start;
>> @@ -882,6 +897,7 @@ static void __meminit remove_pagetable(unsigned long start, unsigned long end)
>>   
>>   		pud_base = (pud_t *)p4d_page_vaddr(*p4d);
>>   		remove_pud_table(pud_base, addr, next);
>> +		free_pud_table(pud_base, p4d);
>>   	}
>>   
>>   	spin_unlock(&init_mm.page_table_lock);
>> -- 
>> 2.26.2


  reply	other threads:[~2020-07-08  2:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25  6:45 [PATCH v2 0/4] powerpc/mm/radix: Memory unplug fixes Aneesh Kumar K.V
2020-06-25  6:45 ` [PATCH v2 1/4] powerpc/mm/radix: Fix PTE/PMD fragment count for early page table mappings Aneesh Kumar K.V
2020-06-25 11:30   ` Aneesh Kumar K.V
2020-06-25  6:45 ` [PATCH v2 2/4] powerpc/mm/radix: Free PUD table when freeing pagetable Aneesh Kumar K.V
2020-07-08  2:12   ` Michael Ellerman
2020-07-08  2:48     ` Aneesh Kumar K.V [this message]
2020-07-08 20:30   ` Reza Arbab
2020-06-25  6:45 ` [PATCH v2 3/4] powerpc/mm/radix: Remove split_kernel_mapping() Aneesh Kumar K.V
2020-06-25  6:45 ` [PATCH v2 4/4] powerpc/mm/radix: Create separate mappings for hot-plugged memory Aneesh Kumar K.V
2020-07-08  4:44   ` Michael Ellerman
2020-07-08  6:24     ` Aneesh Kumar K.V
2020-07-08 12:14       ` Michael Ellerman

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=c9572da4-e354-a65f-c332-c11cd043135b@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=bharata@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.