diff mbox series

[RESEND,RFC] mm: pagemap: add vma(VM_PFNMAP) support in pagemap_pte_hole()

Message ID 20230223024332.1337578-1-sunke@kylinos.cn (mailing list archive)
State New
Headers show
Series [RESEND,RFC] mm: pagemap: add vma(VM_PFNMAP) support in pagemap_pte_hole() | expand

Commit Message

Ke Sun Feb. 23, 2023, 2:43 a.m. UTC
pagemap currently does not support vma(FIXMAP), add support
in pagemap_pte_hole().

Signed-off-by: Ke Sun <sunke@kylinos.cn>
---
 fs/proc/task_mmu.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

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;