Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 May 2014 13:25:06 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r266616 - user/attilio/rm_vmobj_cache/sys/vm
Message-ID:  <201405241325.s4ODP6tq095685@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Sat May 24 13:25:06 2014
New Revision: 266616
URL: http://svnweb.freebsd.org/changeset/base/266616

Log:
  - Assert that VM_ALLOC_WIRED must be provided for unmanaged pages
    allocation
  - Document wiring mandatory for unamanged pages

Modified:
  user/attilio/rm_vmobj_cache/sys/vm/vm_page.c
  user/attilio/rm_vmobj_cache/sys/vm/vm_page.h

Modified: user/attilio/rm_vmobj_cache/sys/vm/vm_page.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/vm/vm_page.c	Sat May 24 13:00:49 2014	(r266615)
+++ user/attilio/rm_vmobj_cache/sys/vm/vm_page.c	Sat May 24 13:25:06 2014	(r266616)
@@ -1450,7 +1450,7 @@ vm_page_alloc(vm_object_t object, vm_pin
 	struct vnode *vp = NULL;
 	vm_object_t m_object;
 	vm_page_t m, mpred;
-	int flags, req_class;
+	int flags, req_class, unmanaged;
 
 	mpred = 0;	/* XXX: pacify gcc */
 	KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) &&
@@ -1462,6 +1462,10 @@ vm_page_alloc(vm_object_t object, vm_pin
 	if (object != NULL)
 		VM_OBJECT_ASSERT_WLOCKED(object);
 
+	unmanaged = (object == NULL || (object->flags & OBJ_UNMANAGED) != 0);
+	KASSERT(unmanaged == 0 || (req & VM_ALLOC_WIRED) != 0,
+	    ("vm_page_alloc: unamanaged but unwired request req(%x)", req));
+
 	req_class = req & VM_ALLOC_CLASS_MASK;
 
 	/*
@@ -1585,8 +1589,7 @@ vm_page_alloc(vm_object_t object, vm_pin
 		flags |= PG_NODUMP;
 	m->flags = flags;
 	m->aflags = 0;
-	m->oflags = object == NULL || (object->flags & OBJ_UNMANAGED) != 0 ?
-	    VPO_UNMANAGED : 0;
+	m->oflags = (unmanaged != 0) ? VPO_UNMANAGED : 0;
 	m->busy_lock = VPB_UNBUSIED;
 	if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ | VM_ALLOC_SBUSY)) == 0)
 		m->busy_lock = VPB_SINGLE_EXCLUSIVER;

Modified: user/attilio/rm_vmobj_cache/sys/vm/vm_page.h
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/vm/vm_page.h	Sat May 24 13:00:49 2014	(r266615)
+++ user/attilio/rm_vmobj_cache/sys/vm/vm_page.h	Sat May 24 13:25:06 2014	(r266616)
@@ -171,6 +171,7 @@ struct vm_page {
  * 	 under PV management cannot be paged out via the
  * 	 object/vm_page_t because there is no knowledge of their pte
  * 	 mappings, and such pages are also not on any PQ queue.
+ *	 VPO_UNMANAGED pages are also mandatory wired.
  *
  */
 #define	VPO_UNUSED01	0x01		/* --available-- */



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