Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Jan 2019 00:55:23 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r342803 - in stable/11/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <201901060055.x060tNWi040026@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;		\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901060055.x060tNWi040026>