Re: [PATCH] mm/hugetlb: avoid corrupting page->mapping in hugetlb_mcopy_atomic_pte

From: Peter Xu
Date: Thu Jul 14 2022 - 11:45:39 EST


On Thu, Jul 14, 2022 at 06:09:49PM +0800, Miaohe Lin wrote:
> As discussed in another thread, we might call page_dup_file_rmap for newly
> allocated page (regardless of this patch). So should we come up a seperate
> patch to call page_add_file_rmap here instead?

Hmm, why we need page_add_file_rmap() even if a new page allocated? Say,
we're at least also using page_dup_file_rmap() in hugetlb_no_page().

I see majorly two things extra there: memcg accounts on NR_FILE_MAPPED, and
mlock. But I assume both of them will not apply to hugetlb pages?

--
Peter Xu