From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
npiggin@gmail.com, benh@kernel.crashing.org, paulus@samba.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/mm/hash/4k: Free hugetlb page table caches correctly.
Date: Tue, 19 Jun 2018 18:55:55 +0530 [thread overview]
Message-ID: <0a99a24e-8859-b853-6902-78e5ee06dee6@linux.ibm.com> (raw)
In-Reply-To: <87o9g7xby7.fsf@concordia.ellerman.id.au>
On 06/19/2018 04:47 PM, Michael Ellerman wrote:
> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>
>> With 4k page size for hugetlb we allocate hugepage directories from its on slab
>> cache. With patch 0c4d26802 ("powerpc/book3s64/mm: Simplify the rcu callback for page table free")
>> we missed to free these allocated hugepd tables.
>>
>> Update pgtable_free to handle hugetlb hugepd directory table.
>>
>> Fixes: 0c4d26802 ("powerpc/book3s64/mm: Simplify the rcu callback for page table free")
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>> arch/powerpc/include/asm/book3s/32/pgalloc.h | 1 +
>> .../include/asm/book3s/64/pgtable-4k.h | 21 +++++++++++++++++++
>> .../include/asm/book3s/64/pgtable-64k.h | 9 ++++++++
>> arch/powerpc/include/asm/book3s/64/pgtable.h | 5 +++++
>> arch/powerpc/include/asm/nohash/32/pgalloc.h | 1 +
>> arch/powerpc/include/asm/nohash/64/pgalloc.h | 1 +
>> arch/powerpc/mm/hugetlbpage.c | 3 ++-
>> arch/powerpc/mm/pgtable-book3s64.c | 12 +++++++++++
>
> Fails with 4K=y HUGETLBFS=n:
>
> arch/powerpc/mm/pgtable-book3s64.c:415:16: error: ‘H_16M_CACHE_INDEX’ undeclared (first use in this function); did you mean ‘H_PUD_CACHE_INDEX’?
>
> ...
>
>> diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c
>> index c1f4ca45c93a..468c3d83a2aa 100644
>> --- a/arch/powerpc/mm/pgtable-book3s64.c
>> +++ b/arch/powerpc/mm/pgtable-book3s64.c
>> @@ -409,6 +409,18 @@ static inline void pgtable_free(void *table, int index)
>> case PUD_INDEX:
>> kmem_cache_free(PGT_CACHE(PUD_CACHE_INDEX), table);
>> break;
>> +#ifdef CONFIG_PPC_4K_PAGES
>> + /* 16M hugepd directory at pud level */
>> + case HTLB_16M_INDEX:
>> + BUILD_BUG_ON(H_16M_CACHE_INDEX <= 0);
>> + kmem_cache_free(PGT_CACHE(H_16M_CACHE_INDEX), table);
>> + break;
>> + /* 16G hugepd directory at the pgd level */
>> + case HTLB_16G_INDEX:
>> + BUILD_BUG_ON(H_16G_CACHE_INDEX <= 0);
>> + kmem_cache_free(PGT_CACHE(H_16G_CACHE_INDEX), table);
>> + break;
>> +#endif
>
> Because this isn't protected by CONFIG_HUGETLBFS.
>
> I assume this is correct?
>
> diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c
> index 468c3d83a2aa..9b7007fd075e 100644
> --- a/arch/powerpc/mm/pgtable-book3s64.c
> +++ b/arch/powerpc/mm/pgtable-book3s64.c
> @@ -409,7 +409,7 @@ static inline void pgtable_free(void *table, int index)
> case PUD_INDEX:
> kmem_cache_free(PGT_CACHE(PUD_CACHE_INDEX), table);
> break;
> -#ifdef CONFIG_PPC_4K_PAGES
> +#if defined(CONFIG_PPC_4K_PAGES) && defined (CONFIG_HUGETLBFS)
> /* 16M hugepd directory at pud level */
> case HTLB_16M_INDEX:
> BUILD_BUG_ON(H_16M_CACHE_INDEX <= 0);
>
>
> cheers
>
Sorry missed that. Can we use #ifdef CONFIG_HUGETLB_PAGE ? That is what
we use to protect that in pgtable-4k.h
-aneesh
-aneesh
next prev parent reply other threads:[~2018-06-19 13:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-14 10:31 [PATCH] powerpc/mm/hash/4k: Free hugetlb page table caches correctly Aneesh Kumar K.V
2018-06-19 11:17 ` Michael Ellerman
2018-06-19 13:25 ` Aneesh Kumar K.V [this message]
2018-06-23 12:56 ` 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=0a99a24e-8859-b853-6902-78e5ee06dee6@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
/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).