linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Bharata B Rao <bharata@linux.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: leonardo@linux.ibm.com, aneesh.kumar@linux.vnet.ibm.com,
	npiggin@gmail.com, Bharata B Rao <bharata@linux.ibm.com>
Subject: Re: [RFC PATCH v0 4/5] powerpc/mm/radix: Free PUD table when freeing pagetable
Date: Mon, 22 Jun 2020 18:37:27 +0530	[thread overview]
Message-ID: <87d05r45bk.fsf@linux.ibm.com> (raw)
In-Reply-To: <20200406034925.22586-5-bharata@linux.ibm.com>

Bharata B Rao <bharata@linux.ibm.com> writes:

> remove_pagetable() isn't freeing PUD table. This causes memory
> leak during memory unplug. Fix this.
>

We had changes w.r.t p4d (folded 5 level table). You may want to get
this updated to recent kernel.

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>


> Signed-off-by: Bharata B Rao <bharata@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 e675c0bbf9a4..0d9ef3277579 100644
> --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
> +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
> @@ -767,6 +767,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, pgd_t *pgd)
> +{
> +	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);
> +	pgd_clear(pgd);
> +}
> +
>  struct change_mapping_params {
>  	pte_t *pte;
>  	unsigned long start;
> @@ -937,6 +952,7 @@ static void __meminit remove_pagetable(unsigned long start, unsigned long end)
>  
>  		pud_base = (pud_t *)pgd_page_vaddr(*pgd);
>  		remove_pud_table(pud_base, addr, next);
> +		free_pud_table(pud_base, pgd);
>  	}
>  
>  	spin_unlock(&init_mm.page_table_lock);
> -- 
> 2.21.0

  reply	other threads:[~2020-06-22 13:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06  3:49 [RFC PATCH v0 0/5] powerpc/mm/radix: Memory unplug fixes Bharata B Rao
2020-04-06  3:49 ` [RFC PATCH v0 1/5] powerpc/pseries/hotplug-memory: Set DRCONF_MEM_HOTREMOVABLE for hot-plugged mem Bharata B Rao
2020-04-06  3:49 ` [RFC PATCH v0 2/5] powerpc/mm/radix: Create separate mappings for hot-plugged memory Bharata B Rao
2020-06-22 12:46   ` Aneesh Kumar K.V
2020-04-06  3:49 ` [RFC PATCH v0 3/5] powerpc/mm/radix: Fix PTE/PMD fragment count for early page table mappings Bharata B Rao
2020-06-22 12:53   ` Aneesh Kumar K.V
2020-06-22 13:22   ` Aneesh Kumar K.V
2020-04-06  3:49 ` [RFC PATCH v0 4/5] powerpc/mm/radix: Free PUD table when freeing pagetable Bharata B Rao
2020-06-22 13:07   ` Aneesh Kumar K.V [this message]
2020-04-06  3:49 ` [RFC PATCH v0 5/5] powerpc/mm/radix: Remove split_kernel_mapping() Bharata B Rao
2020-06-22 13:07   ` Aneesh Kumar K.V
2020-04-09  4:31 ` [RFC PATCH v0 0/5] powerpc/mm/radix: Memory unplug fixes Bharata B Rao
2020-05-20  4:34 ` Bharata B Rao

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=87d05r45bk.fsf@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=bharata@linux.ibm.com \
    --cc=leonardo@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    /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 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).