Re: [PATCH 1/8] mm: Introduce vma_is_special_huge

From: Andrew Morton
Date: Sat Feb 29 2020 - 23:05:45 EST


On Tue, 3 Dec 2019 14:22:32 +0100 Thomas Hellström (VMware) <thomas_os@xxxxxxxxxxxx> wrote:

> From: Thomas Hellstrom <thellstrom@xxxxxxxxxx>
>
> For VM_PFNMAP and VM_MIXEDMAP vmas that want to support transhuge pages
> and -page table entries, introduce vma_is_special_huge() that takes the
> same codepaths as vma_is_dax().
>
> The use of "special" follows the definition in memory.c, vm_normal_page():
> "Special" mappings do not wish to be associated with a "struct page"
> (either it doesn't exist, or it exists but they don't want to touch it)
>
> For PAGE_SIZE pages, "special" is determined per page table entry to be
> able to deal with COW pages. But since we don't have huge COW pages,
> we can classify a vma as either "special huge" or "normal huge".
>
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2822,6 +2822,12 @@ extern long copy_huge_page_from_user(struct page *dst_page,
> const void __user *usr_src,
> unsigned int pages_per_huge_page,
> bool allow_pagefault);
> +static inline bool vma_is_special_huge(struct vm_area_struct *vma)
> +{
> + return vma_is_dax(vma) || (vma->vm_file &&
> + (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)));
> +}

Some documetnation would be nice. Not only what it does, but why it
does it. ie, what is the *meaning* of vma_is_spacial_huge(vma)==true?