Re: [PATCH v4 2/2] arm64: mm: hugetlb: Enable HUGETLB_PAGE_FREE_VMEMMAP for arm64

From: Muchun Song
Date: Mon Apr 11 2022 - 07:55:51 EST


On Mon, Apr 11, 2022 at 03:42:52PM +0530, Anshuman Khandual wrote:
>
>
> On 3/31/22 12:26, Muchun Song wrote:
> > --- a/arch/arm64/mm/flush.c
> > +++ b/arch/arm64/mm/flush.c
> > @@ -68,6 +68,19 @@ EXPORT_SYMBOL_GPL(__sync_icache_dcache);
> > */
> > void flush_dcache_page(struct page *page)
> > {
> > + /*
> > + * Only the head page's flags of HugeTLB can be cleared since the tail
> > + * vmemmap pages associated with each HugeTLB page are mapped with
> > + * read-only when CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is enabled (more
> > + * details can refer to vmemmap_remap_pte()). Although
>
> Did you see real permission fault when flush_dcache_page() accessed remapped
> tail pages, with readonly vmemmap ? OR this change is from code inspection ?
>

Not a real word issue. Just a code-inspection one.

> > + * __sync_icache_dcache() only set PG_dcache_clean flag on the head
> > + * page struct, some tail page structs still can be seen the flag is
>
> Sentence here needs restructuring .... ^^^^^^^^^^^^^^^^^^
>

Will do.

> > + * set since the head vmemmap page frame is reused (more details can
> > + * refer to the comments above page_fixed_fake_head()).
> > + */
> > + if (hugetlb_free_vmemmap_enabled() && PageHuge(page))
> > + page = compound_head(page);
>
> This should also be applicable to any other platform with both configs enabled
> i.e ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE and ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP ?

Yes.

> If yes, then how to ensure that the platforms change flush_dcache_page() before
> subscribing into ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP ?
>

The one who enable this feature has to make sure there is no any issues
(e.g. He should fix flush_dcache_page() or other related issues) with this
feature enabled.

Thanks.