[RESEND PATCH RFC] mm: pagemap: add vma(VM_PFNMAP) support in pagemap_pte_hole()
From: Ke Sun
Date: Wed Feb 22 2023 - 21:44:17 EST
pagemap currently does not support vma(FIXMAP), add support
in pagemap_pte_hole().
Signed-off-by: Ke Sun <sunke@xxxxxxxxxx>
---
fs/proc/task_mmu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index af1c49ae11b1..297c7b9dc630 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1400,6 +1400,11 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end,
if (vma->vm_flags & VM_SOFTDIRTY)
pme = make_pme(0, PM_SOFT_DIRTY);
for (; addr < min(end, vma->vm_end); addr += PAGE_SIZE) {
+ if ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff) {
+ unsigned long pgoff = (addr - vma->vm_start) >> PAGE_SHIFT;
+
+ pme = make_pme(vma->vm_pgoff + pgoff, PM_PRESENT);
+ }
err = add_to_pagemap(addr, &pme, pm);
if (err)
goto out;
--
2.25.1