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 ? > + * __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 .... ^^^^^^^^^^^^^^^^^^ > + * 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 ? If yes, then how to ensure that the platforms change flush_dcache_page() before subscribing into ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP ? > + > if (test_bit(PG_dcache_clean, &page->flags)) > clear_bit(PG_dcache_clean, &page->flags); > }