Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2014 23:13:18 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r266601 - in user/attilio/rm_vmobj_cache/sys: mips/mips vm
Message-ID:  <201405232313.s4NNDIvu010705@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri May 23 23:13:17 2014
New Revision: 266601
URL: http://svnweb.freebsd.org/changeset/base/266601

Log:
  The pages returned by vm_page_alloc_freelist() will always be unmanaged,
  so also make them mandatory wired.
  Avoid to pass then VM_ALLOC_WIRED in the allocation request.

Modified:
  user/attilio/rm_vmobj_cache/sys/mips/mips/pmap.c
  user/attilio/rm_vmobj_cache/sys/mips/mips/uma_machdep.c
  user/attilio/rm_vmobj_cache/sys/vm/vm_page.c

Modified: user/attilio/rm_vmobj_cache/sys/mips/mips/pmap.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/mips/mips/pmap.c	Fri May 23 22:50:49 2014	(r266600)
+++ user/attilio/rm_vmobj_cache/sys/mips/mips/pmap.c	Fri May 23 23:13:17 2014	(r266601)
@@ -1047,8 +1047,7 @@ pmap_alloc_direct_page(unsigned int inde
 {
 	vm_page_t m;
 
-	m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, req | VM_ALLOC_WIRED |
-	    VM_ALLOC_ZERO);
+	m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, req | VM_ALLOC_ZERO);
 	if (m == NULL)
 		return (NULL);
 
@@ -1581,8 +1580,7 @@ retry:
 		}
 	}
 	/* No free items, allocate another chunk */
-	m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, VM_ALLOC_NORMAL |
-	    VM_ALLOC_WIRED);
+	m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, VM_ALLOC_NORMAL);
 	if (m == NULL) {
 		if (try) {
 			pv_entry_count--;

Modified: user/attilio/rm_vmobj_cache/sys/mips/mips/uma_machdep.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/mips/mips/uma_machdep.c	Fri May 23 22:50:49 2014	(r266600)
+++ user/attilio/rm_vmobj_cache/sys/mips/mips/uma_machdep.c	Fri May 23 23:13:17 2014	(r266601)
@@ -49,7 +49,7 @@ uma_small_alloc(uma_zone_t zone, int byt
 	void *va;
 
 	*flags = UMA_SLAB_PRIV;
-	pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED;
+	pflags = malloc2vm_flags(wait);
 
 	for (;;) {
 		m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, pflags);

Modified: user/attilio/rm_vmobj_cache/sys/vm/vm_page.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/vm/vm_page.c	Fri May 23 22:50:49 2014	(r266600)
+++ user/attilio/rm_vmobj_cache/sys/vm/vm_page.c	Fri May 23 23:13:17 2014	(r266601)
@@ -1883,6 +1883,8 @@ vm_page_alloc_init(vm_page_t m)
  *
  *	The caller must always specify an allocation class.
  *
+ *	The returned page will be wired.
+ *
  *	allocation classes:
  *	VM_ALLOC_NORMAL		normal process request
  *	VM_ALLOC_SYSTEM		system *really* needs a page
@@ -1891,7 +1893,6 @@ vm_page_alloc_init(vm_page_t m)
  *	optional allocation flags:
  *	VM_ALLOC_COUNT(number)	the number of additional pages that the caller
  *				intends to allocate
- *	VM_ALLOC_WIRED		wire the allocated page
  *	VM_ALLOC_ZERO		prefer a zeroed page
  *
  *	This routine may not sleep.
@@ -1904,6 +1905,10 @@ vm_page_alloc_freelist(int flind, int re
 	u_int flags;
 	int req_class;
 
+	KASSERT((req & VM_ALLOC_WIRED) == 0,
+	    ("vm_page_alloc_freelist: VM_ALLOC_WIRED passed in req (%x)",
+	    req));
+
 	req_class = req & VM_ALLOC_CLASS_MASK;
 
 	/*
@@ -1944,14 +1949,14 @@ vm_page_alloc_freelist(int flind, int re
 	if ((req & VM_ALLOC_ZERO) != 0)
 		flags = PG_ZERO;
 	m->flags &= flags;
-	if ((req & VM_ALLOC_WIRED) != 0) {
-		/*
-		 * The page lock is not required for wiring a page that does
-		 * not belong to an object.
-		 */
-		atomic_add_int(&vm_cnt.v_wire_count, 1);
-		m->wire_count = 1;
-	}
+
+	/*
+	 * The page lock is not required for wiring a page that does
+	 * not belong to an object.
+	 */
+	atomic_add_int(&vm_cnt.v_wire_count, 1);
+	m->wire_count = 1;
+
 	/* Unmanaged pages don't use "act_count". */
 	m->oflags = VPO_UNMANAGED;
 	if (drop != NULL)



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