simplify follow_pte a bit
Subsystems (8)
Hi Andrew,
this small series drops the not needed follow_pte_pmd exports, and simplifies the follow_pte family of functions a bit.
PATCH 1/2 mm: unexport follow_pte_pmd
follow_pte_pmd is only used by the DAX code, which can't be modular.
--- mm/memory.c | 1 - 1 file changed, 1 deletion(-)
mm/memory.c +0 -1
@@ -4787,7 +4787,6 @@ int follow_pte_pmd(struct mm_struct *mm, unsigned long address, ptepp, pmdpp, ptlp)));return res; } -EXPORT_SYMBOL (follow_pte_pmd);/** * follow_pfn - look up PFN at a user virtual address
Signature · 4 lines
2.28.0 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Re: [PATCH 1/2] mm: unexport follow_pte_pmd
Quoted 3 lines · Christoph Hellwig
follow_pte_pmdis only used by the DAX code, which can't be modular.Signed-off-by Christoph Hellwig <[email protected]>
PATCH 2/2 mm: simplify follow_pte{,pmd}
In reply to Christoph HellwigMerge __follow_pte_pmd, follow_pte_pmd and follow_pte into a single follow_pte function and just pass two additional NULL arguments for the two previous follow_pte callers.
--- fs/dax.c | 9 ++++----- include/linux/mm.h | 6 +++--- mm/memory.c | 35 +++++------------------------------ 3 files changed, 12 insertions(+), 38 deletions(-)
fs/dax.c +4 -5
@@ -810,12 +810,11 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index, address =pgoff_address (index, vma);/* -* Note because we provide range to follow_pte_pmd it will -* call mmu_notifier_invalidate_range_start() on our behalf -* before taking any lock. +* Note because we provide range to follow_pte it will call +* mmu_notifier_invalidate_range_start() on our behalf before +* taking any lock. */ -if (follow_pte_pmd (vma->vm_mm, address, &range, - &ptep, &pmdp, &ptl)) +if (follow_pte (vma->vm_mm, address, &range, &ptep, &pmdp, &ptl))continue ;/*
include/linux/mm.h +3 -3
@@ -1655,9 +1655,9 @@ 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 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); +int follow_pte (struct mm_struct *mm,unsigned long address, +struct mmu_notifier_range *range,pte_t **ptepp,pmd_t **pmdpp, +spinlock_t **ptlp);int follow_pfn (struct vm_area_struct *vma,unsigned long address,unsigned long *pfn); int follow_phys(struct vm_area_struct *vma, unsigned long address,
mm/memory.c +5 -30
@@ -4696,9 +4696,9 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address) }#endif /* __PAGETABLE_PMD_FOLDED */ -static 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) +int follow_pte (struct mm_struct *mm,unsigned long address, +struct mmu_notifier_range *range,pte_t **ptepp,pmd_t **pmdpp, +spinlock_t **ptlp) {pgd_t *pgd;p4d_t *p4d;
@@ -4763,31 +4763,6 @@ static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address,return -EINVAL ; } -static inline int follow_pte (struct mm_struct *mm,unsigned long address, -pte_t **ptepp,spinlock_t **ptlp) -{ -int res; - -/* (void) is needed to make gcc happy */ - (void )__cond_lock (*ptlp, - !(res =__follow_pte_pmd (mm, address,NULL , - ptepp,NULL , ptlp))); -return res; -} - -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) -{ -int res; - -/* (void) is needed to make gcc happy */ - (void )__cond_lock (*ptlp, - !(res =__follow_pte_pmd (mm, address, range, - ptepp, pmdpp, ptlp))); -return res; -} -/** * follow_pfn - look up PFN at a user virtual address * @vma: memory mapping
@@ -4808,7 +4783,7 @@ int follow_pfn(struct vm_area_struct *vma, unsigned long address,if (!(vma->vm_flags & (VM_IO |VM_PFNMAP )))return ret; - ret =follow_pte (vma->vm_mm, address, &ptep, &ptl); + ret =follow_pte (vma->vm_mm, address,NULL , &ptep,NULL , &ptl);if (ret)return ret; *pfn =pte_pfn (*ptep);
@@ -4829,7 +4804,7 @@ int follow_phys(struct vm_area_struct *vma,if (!(vma->vm_flags & (VM_IO |VM_PFNMAP ))) goto out; -if (follow_pte (vma->vm_mm, address, &ptep, &ptl)) +if (follow_pte (vma->vm_mm, address,NULL , &ptep,NULL , &ptl)) goto out; pte = *ptep;
Signature · 4 lines
2.28.0 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Re: [PATCH 2/2] mm: simplify follow_pte{,pmd}
Quoted 5 lines · Christoph Hellwig
Merge
__follow_pte_pmd,follow_pte_pmdandfollow_pteinto a singlefollow_ptefunction and just pass two additional NULL arguments for the two previousfollow_ptecallers.Signed-off-by Christoph Hellwig <[email protected]>
I'm not entirely convinced this is the right interface, but your patch makes things better, so I approve.
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Re: [PATCH 2/2] mm: simplify follow_pte{,pmd}
In reply to Christoph HellwigSorry, I think this patch may be causing a regression for us for s390?
https://travis-ci.com/github/ClangBuiltLinux/continuous-integration/jobs/432129279#L768
Re: [PATCH 2/2] mm: simplify follow_pte{,pmd}
Quoted 4 lines · Nick Desaulniers
Sorry, I think this patch may be causing a regression for us for s390?
https://travis-ci.com/github/ClangBuiltLinux/continuous-integration/jobs/432129279#L768
Hmm, the call to follow_pte_pmd in the s390 code does not actually exist in my tree.
Re: [PATCH 2/2] mm: simplify follow_pte{,pmd}
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Nick Desaulniers
Sorry, I think this patch may be causing a regression for us for s390?
https://travis-ci.com/github/ClangBuiltLinux/continuous-integration/jobs/432129279#L768Hmm, the call to
follow_pte_pmdin the s390 code does not actually exist in my tree.
This is a mid-air collision in linux-next between
b2ff5796a934 ("mm: simplify follow_pte{,pmd}") a67a88b0b8de ("s390/pci: remove races against pte updates")
Re: [PATCH 2/2] mm: simplify follow_pte{,pmd}
Quoted 8 lines · Christian Borntraeger
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Nick Desaulniers
Sorry, I think this patch may be causing a regression for us for s390?
https://travis-ci.com/github/ClangBuiltLinux/continuous-integration/jobs/432129279#L768
Quoted 7 lines
Quoted 2 lines
Hmm, the call to
follow_pte_pmdin the s390 code does not actually exist in my tree.This is a mid-air collision in linux-next between
b2ff5796a934("mm: simplify follow_pte{,pmd}")a67a88b0b8de("s390/pci: remove races against pte updates")
Ah. The fixup is trivial: just s/follow_pte_pmd/follow_pte/.
Re: [PATCH 2/2] mm: simplify follow_pte{,pmd}
Hi Christoph,
Quoted 13 lines · On Wed, 11 Nov 2020 09:28:42 +0100 Christoph Hellwig <[email protected]> wrote:
Quoted 11 lines · Christian Borntraeger
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Nick Desaulniers
Sorry, I think this patch may be causing a regression for us for s390?
https://travis-ci.com/github/ClangBuiltLinux/continuous-integration/jobs/432129279#L768Hmm, the call to
follow_pte_pmdin the s390 code does not actually exist in my tree.
Quoted 6 lines
Quoted 4 lines
This is a mid-air collision in linux-next between
b2ff5796a934("mm: simplify follow_pte{,pmd}")a67a88b0b8de("s390/pci: remove races against pte updates")Ah. The fixup is trivial: just s/follow_pte_pmd/follow_pte/.
ok, so tomorrow I will add the following to the merge of the akpm-current tree:
From: Stephen Rothwell <[email protected]>
Date: Wed, 11 Nov 2020 22:08:32 +1100
Subject: [PATCH] merge fix for "s390/pci: remove races against pte updates"
--- arch/s390/pci/pci_mmio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/pci/pci_mmio.c +2 -2
@@ -173,7 +173,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,if (!(vma->vm_flags &VM_WRITE )) goto out_unlock_mmap; - ret =follow_pte_pmd (vma->vm_mm, mmio_addr,NULL , &ptep,NULL , &ptl); + ret =follow_pte (vma->vm_mm, mmio_addr,NULL , &ptep,NULL , &ptl);if (ret) goto out_unlock_mmap;
@@ -317,7 +317,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,if (!(vma->vm_flags &VM_WRITE )) goto out_unlock_mmap; - ret =follow_pte_pmd (vma->vm_mm, mmio_addr,NULL , &ptep,NULL , &ptl); + ret =follow_pte (vma->vm_mm, mmio_addr,NULL , &ptep,NULL , &ptl);if (ret) goto out_unlock_mmap;
Signature · 5 lines
2.29.2 -- Cheers, Stephen Rothwell
Quoted 4 lines · Christoph Hellwig
Hi Andrew,
this small series drops the not needed
follow_pte_pmdexports, and simplifies thefollow_ptefamily of functions a bit.
any comments?