svn commit: r342803 - in stable/11/sys/compat/linuxkpi/common: include/linux src

Konstantin Belousov kib at FreeBSD.org
Sun Jan 6 00:55:24 UTC 2019


Author: kib
Date: Sun Jan  6 00:55:23 2019
New Revision: 342803
URL: https://svnweb.freebsd.org/changeset/base/342803

Log:
  MFC r342627:
  Implement zap_vma_ptes() for managed device objects.

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/mm.h
  stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/mm.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/mm.h	Sun Jan  6 00:54:08 2019	(r342802)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/mm.h	Sun Jan  6 00:55:23 2019	(r342803)
@@ -180,12 +180,8 @@ apply_to_page_range(struct mm_struct *mm, unsigned lon
 	return (-ENOTSUP);
 }
 
-static inline int
-zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
-    unsigned long size)
-{
-	return (-ENOTSUP);
-}
+int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+    unsigned long size);
 
 static inline int
 remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c	Sun Jan  6 00:54:08 2019	(r342802)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c	Sun Jan  6 00:55:23 2019	(r342803)
@@ -672,6 +672,25 @@ static struct cdev_pager_ops linux_cdev_pager_ops[2] =
   },
 };
 
+int
+zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+    unsigned long size)
+{
+	vm_object_t obj;
+	vm_page_t m;
+
+	obj = vma->vm_obj;
+	if (obj == NULL || (obj->flags & OBJ_UNMANAGED) != 0)
+		return (-ENOTSUP);
+	VM_OBJECT_RLOCK(obj);
+	for (m = vm_page_find_least(obj, OFF_TO_IDX(address));
+	    m != NULL && m->pindex < OFF_TO_IDX(address + size);
+	    m = TAILQ_NEXT(m, listq))
+		pmap_remove_all(m);
+	VM_OBJECT_RUNLOCK(obj);
+	return (0);
+}
+
 #define	OPW(fp,td,code) ({			\
 	struct file *__fpop;			\
 	__typeof(code) __retval;		\


More information about the svn-src-all mailing list