Re: [PATCH v2 2/4] mm/fork: Pass new vma pointer into copy_page_range()

From: Kirill A. Shutemov
Date: Wed Sep 30 2020 - 09:31:03 EST


On Fri, Sep 25, 2020 at 06:25:58PM -0400, Peter Xu wrote:
> This prepares for the future work to trigger early cow on pinned pages during
> fork(). No functional change intended.
>
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
> ---
> include/linux/mm.h | 2 +-
> kernel/fork.c | 2 +-
> mm/memory.c | 14 +++++++++-----
> 3 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index b2f370f0b420..ae914be004b3 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1646,7 +1646,7 @@ struct mmu_notifier_range;
> void free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
> unsigned long end, unsigned long floor, unsigned long ceiling);
> int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
> - struct vm_area_struct *vma);
> + struct vm_area_struct *vma, struct vm_area_struct *new);

It makes dst/src mm_struct arguments redundant. There's always vma->vm_mm.

--
Kirill A. Shutemov