From: zhichang.yuan@linaro.org (zhichang.yuan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64:mm: free the useless initial page table
Date: Tue, 25 Nov 2014 22:41:35 +0800 [thread overview]
Message-ID: <5474951F.8050809@linaro.org> (raw)
In-Reply-To: <20141124143208.GE15872@e104818-lin.cambridge.arm.com>
On 2014?11?24? 22:32, Catalin Marinas wrote:
> On Fri, Nov 21, 2014 at 08:27:40AM +0000, zhichang.yuan at linaro.org wrote:
>> From: "zhichang.yuan" <zhichang.yuan@linaro.org>
>>
>> For 64K page system, after mapping a PMD section, the corresponding initial
>> page table is not needed any more. That page can be freed.
>>
>> Signed-off-by: Zhichang Yuan <zhichang.yuan@linaro.org>
>> ---
>> arch/arm64/mm/mmu.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
>> index f4f8b50..12a336b 100644
>> --- a/arch/arm64/mm/mmu.c
>> +++ b/arch/arm64/mm/mmu.c
>> @@ -191,8 +191,11 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
>> * Check for previous table entries created during
>> * boot (__create_page_tables) and flush them.
>> */
>> - if (!pmd_none(old_pmd))
>> + if (!pmd_none(old_pmd)) {
>> flush_tlb_all();
>> + if (pmd_table(old_pmd))
>> + memblock_free(pte_pfn(pmd_pte(old_pmd)) << PAGE_SHIFT, PAGE_SIZE);
>> + }
> For consistency with alloc_init_pud(), could you do:
>
> phys_addr_t table = __pa(pte_offset(&old_pmd, 0));
> memblock_free(table, PAGE_SIZE);
Just as Laura comments, the pte_offset will convert the PA to VA, and then convert VA to PA. It seems to be
verbose. That is why i use pte_pfn. Anyway, the consistency is better, i will revise it.
> Since you are at this, for alloc_init_pud() could you please move the
> flush_tlb_all() before memblock_free()? Theoretical problem really but
> it's nice for consistency.
>
> Thanks.
>
As for this issue, i have a small question. Since the new PMD entry had been set by set_pmd, why not do the
tlb flush as soon as we can?
Thanks!
next prev parent reply other threads:[~2014-11-25 14:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-21 8:27 [PATCH] arm64:mm: free the useless initial page table zhichang.yuan at linaro.org
2014-11-24 14:32 ` Catalin Marinas
2014-11-25 14:41 ` zhichang.yuan [this message]
2014-11-27 12:26 ` Catalin Marinas
2014-11-29 2:20 ` zhichang.yuan
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=5474951F.8050809@linaro.org \
--to=zhichang.yuan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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 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.