mm: Remove src/dst mm parameter in copy_page_range()
Subsystems (4)
PATCH v2 1/1 mm: Remove src/dst mm parameter in copy_page_range()
Both of the mm pointers are not needed after commit 7a4830c380f3 ("mm/fork:
Pass new vma pointer into copy_page_range()").
Jason Gunthorpe also reported that the ordering of copy_page_range() is odd. Since working at it, reorder the parameters to be logical, by (1) always put the dst_* fields to be before src_* fields, and (2) keep the same type of parameters together.
---
v2:
- further reorder some parameters and line format [Jason]
--- include/linux/mm.h | 4 +- kernel/fork.c | 2 +- mm/memory.c | 139 ++++++++++++++++++++++++--------------------- 3 files changed, 76 insertions(+), 69 deletions(-)
include/linux/mm.h +2 -2
@@ -1645,8 +1645,8 @@ 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 *new); +int +copy_page_range (struct vm_area_struct *dst_vma,struct vm_area_struct *src_vma);int follow_pte_pmd (struct mm_struct *mm,unsigned long address,struct mmu_notifier_range *range,pte_t **ptepp,pmd_t **pmdpp,spinlock_t **ptlp);
kernel/fork.c +1 -1
@@ -589,7 +589,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, mm->map_count++;if (!(tmp->vm_flags &VM_WIPEONFORK )) - retval =copy_page_range (mm, oldmm, mpnt, tmp); + retval =copy_page_range (tmp, mpnt);if (tmp->vm_ops && tmp->vm_ops->open) tmp->vm_ops->open (tmp);
mm/memory.c +73 -66
283 lines not on this page · raw message
Signature · 1 line
2.26.2
Quoted 12 lines · Peter Xu
Both of the mm pointers are not needed after commit
7a4830c380f3("mm/fork:
Pass new vma pointer intocopy_page_range()").Jason Gunthorpe also reported that the ordering of
copy_page_range()is odd. Since working at it, reorder the parameters to be logical, by (1) always put the dst_* fields to be before src_* fields, and (2) keep the same type of parameters together.CC Jason Gunthorpe <[email protected]>CC Andrew Morton <[email protected]>Reported-by Kirill A. Shutemov <[email protected]>Signed-off-by Peter Xu <[email protected]>
Quoted 8 lines
---
v2:
- further reorder some parameters and line format [Jason]--- include/linux/mm.h | 4 +- kernel/fork.c | 2 +- mm/memory.c | 139 ++++++++++++++++++++++++--------------------- 3 files changed, 76 insertions(+), 69 deletions(-)
Thanks, looks more readable to me
Jason
Quoted 8 lines · Peter Xu
Both of the mm pointers are not needed after commit
7a4830c380f3("mm/fork:
Pass new vma pointer intocopy_page_range()").Jason Gunthorpe also reported that the ordering of
copy_page_range()is odd. Since working at it, reorder the parameters to be logical, by (1) always put the dst_* fields to be before src_* fields, and (2) keep the same type of parameters together.
Quoted 4 lines
CC Jason Gunthorpe <[email protected]>CC Andrew Morton <[email protected]>Reported-by Kirill A. Shutemov <[email protected]>Signed-off-by Peter Xu <[email protected]>
Signature · 1 line
Kirill A. Shutemov