Re: [PATCH 3/3] mm: move follow_phys to arch/x86/mm/pat/memtype.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25.03.24 00:45, Christoph Hellwig wrote:
follow_phys is only used by two allers in arch/x86/mm/pat/memtype.c.
Move it there and hardcode the two arguments that get the same values
passed by both caller.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
  arch/x86/mm/pat/memtype.c | 22 ++++++++++++++++++++--
  include/linux/mm.h        |  2 --
  mm/memory.c               | 28 ----------------------------
  3 files changed, 20 insertions(+), 32 deletions(-)

diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index 0d72183b5dd028..bad99eb5c95b0d 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -947,6 +947,24 @@ static void free_pfn_range(u64 paddr, unsigned long size)
  		memtype_free(paddr, paddr + size);
  }
+static int follow_phys(struct vm_area_struct *vma, unsigned long *prot,
+		resource_size_t *phys)
+{
+	pte_t *ptep, pte;
+	spinlock_t *ptl;
+
+	if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
+		return -EINVAL;
+
+	if (follow_pte(vma->vm_mm, vma->vm_start, &ptep, &ptl))
+		return -EINVAL;

I have a patch here that (a) makes follow_pte() consume a VMA instead of a MM, and (b) moves the VMA check into follow_pte().

While you're at it, and if you're resending this, you might want to include similar changes; otherwise I'll can send this myself later on top.

--
Cheers,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux