Re: [PATCH v6 13/26] mm/memory: Add vmf_insert_page_mkwrite()
From: Dan Williams
Date: Mon Jan 13 2025 - 20:15:39 EST
Alistair Popple wrote:
> Currently to map a DAX page the DAX driver calls vmf_insert_pfn. This
> creates a special devmap PTE entry for the pfn but does not take a
> reference on the underlying struct page for the mapping. This is
> because DAX page refcounts are treated specially, as indicated by the
> presence of a devmap entry.
>
> To allow DAX page refcounts to be managed the same as normal page
> refcounts introduce vmf_insert_page_mkwrite(). This will take a
> reference on the underlying page much the same as vmf_insert_page,
> except it also permits upgrading an existing mapping to be writable if
> requested/possible.
>
> Signed-off-by: Alistair Popple <apopple@xxxxxxxxxx>
>
> ---
>
> Updates from v2:
>
> - Rename function to make not DAX specific
>
> - Split the insert_page_into_pte_locked() change into a separate
> patch.
>
> Updates from v1:
>
> - Re-arrange code in insert_page_into_pte_locked() based on comments
> from Jan Kara.
>
> - Call mkdrity/mkyoung for the mkwrite case, also suggested by Jan.
> ---
> include/linux/mm.h | 2 ++
> mm/memory.c | 36 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 38 insertions(+)
Looks good to me, you can add:
Reviewed-by: Dan Williams <dan.j.williams@xxxxxxxxx>