Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2012 21:12:52 +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-9@freebsd.org
Subject:   svn commit: r236923 - stable/9/sys/vm
Message-ID:  <201206112112.q5BLCqWu010376@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Jun 11 21:12:52 2012
New Revision: 236923
URL: http://svn.freebsd.org/changeset/base/236923

Log:
  MFC r235366:
  Split the code from vm_page_getfake() to initialize the fake page struct
  vm_page into new interface vm_page_initfake(). Handle the case of fake
  page re-initialization with changed memattr.

Modified:
  stable/9/sys/vm/vm_page.c
  stable/9/sys/vm/vm_page.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_page.c
==============================================================================
--- stable/9/sys/vm/vm_page.c	Mon Jun 11 21:08:52 2012	(r236922)
+++ stable/9/sys/vm/vm_page.c	Mon Jun 11 21:12:52 2012	(r236923)
@@ -645,6 +645,22 @@ vm_page_getfake(vm_paddr_t paddr, vm_mem
 	vm_page_t m;
 
 	m = uma_zalloc(fakepg_zone, M_WAITOK | M_ZERO);
+	vm_page_initfake(m, paddr, memattr);
+	return (m);
+}
+
+void
+vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr)
+{
+
+	if ((m->flags & PG_FICTITIOUS) != 0) {
+		/*
+		 * The page's memattr might have changed since the
+		 * previous initialization.  Update the pmap to the
+		 * new memattr.
+		 */
+		goto memattr;
+	}
 	m->phys_addr = paddr;
 	m->queue = PQ_NONE;
 	/* Fictitious pages don't use "segind". */
@@ -652,8 +668,8 @@ vm_page_getfake(vm_paddr_t paddr, vm_mem
 	/* Fictitious pages don't use "order" or "pool". */
 	m->oflags = VPO_BUSY | VPO_UNMANAGED;
 	m->wire_count = 1;
+memattr:
 	pmap_page_set_memattr(m, memattr);
-	return (m);
 }
 
 /*

Modified: stable/9/sys/vm/vm_page.h
==============================================================================
--- stable/9/sys/vm/vm_page.h	Mon Jun 11 21:08:52 2012	(r236922)
+++ stable/9/sys/vm/vm_page.h	Mon Jun 11 21:12:52 2012	(r236923)
@@ -390,6 +390,7 @@ void vm_page_dontneed(vm_page_t);
 void vm_page_deactivate (vm_page_t);
 vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t);
 vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr);
+void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr);
 void vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
 boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex);
 vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t);



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