Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 May 2017 01:53:06 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r317624 - user/markj/PQ_LAUNDRY_11/sys/vm
Message-ID:  <201705010153.v411r6Ei087248@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon May  1 01:53:05 2017
New Revision: 317624
URL: https://svnweb.freebsd.org/changeset/base/317624

Log:
  MFC r309365 (by alc):
  Simplify vm_radix_insert() and vm_radix_remove().

Modified:
  user/markj/PQ_LAUNDRY_11/sys/vm/_vm_radix.h
  user/markj/PQ_LAUNDRY_11/sys/vm/vm_object.c
  user/markj/PQ_LAUNDRY_11/sys/vm/vm_radix.c
Directory Properties:
  user/markj/PQ_LAUNDRY_11/   (props changed)

Modified: user/markj/PQ_LAUNDRY_11/sys/vm/_vm_radix.h
==============================================================================
--- user/markj/PQ_LAUNDRY_11/sys/vm/_vm_radix.h	Mon May  1 01:52:03 2017	(r317623)
+++ user/markj/PQ_LAUNDRY_11/sys/vm/_vm_radix.h	Mon May  1 01:53:05 2017	(r317624)
@@ -36,12 +36,8 @@
  */
 struct vm_radix {
 	uintptr_t	rt_root;
-	uint8_t		rt_flags;
 };
 
-#define	RT_INSERT_INPROG	0x01
-#define	RT_TRIE_MODIFIED	0x02
-
 #ifdef _KERNEL
 
 static __inline boolean_t

Modified: user/markj/PQ_LAUNDRY_11/sys/vm/vm_object.c
==============================================================================
--- user/markj/PQ_LAUNDRY_11/sys/vm/vm_object.c	Mon May  1 01:52:03 2017	(r317623)
+++ user/markj/PQ_LAUNDRY_11/sys/vm/vm_object.c	Mon May  1 01:53:05 2017	(r317624)
@@ -205,7 +205,6 @@ vm_object_zinit(void *mem, int size, int
 	object->type = OBJT_DEAD;
 	object->ref_count = 0;
 	object->rtree.rt_root = 0;
-	object->rtree.rt_flags = 0;
 	object->paging_in_progress = 0;
 	object->resident_page_count = 0;
 	object->shadow_count = 0;

Modified: user/markj/PQ_LAUNDRY_11/sys/vm/vm_radix.c
==============================================================================
--- user/markj/PQ_LAUNDRY_11/sys/vm/vm_radix.c	Mon May  1 01:52:03 2017	(r317623)
+++ user/markj/PQ_LAUNDRY_11/sys/vm/vm_radix.c	Mon May  1 01:53:05 2017	(r317624)
@@ -339,8 +339,6 @@ vm_radix_insert(struct vm_radix *rtree, 
 
 	index = page->pindex;
 
-restart:
-
 	/*
 	 * The owner of record for root is not really important because it
 	 * will never be used.
@@ -358,32 +356,10 @@ restart:
 				panic("%s: key %jx is already present",
 				    __func__, (uintmax_t)index);
 			clev = vm_radix_keydiff(m->pindex, index);
-
-			/*
-			 * During node allocation the trie that is being
-			 * walked can be modified because of recursing radix
-			 * trie operations.
-			 * If this is the case, the recursing functions signal
-			 * such situation and the insert operation must
-			 * start from scratch again.
-			 * The freed radix node will then be in the UMA
-			 * caches very likely to avoid the same situation
-			 * to happen.
-			 */
-			rtree->rt_flags |= RT_INSERT_INPROG;
 			tmp = vm_radix_node_get(vm_radix_trimkey(index,
 			    clev + 1), 2, clev);
-			rtree->rt_flags &= ~RT_INSERT_INPROG;
-			if (tmp == NULL) {
-				rtree->rt_flags &= ~RT_TRIE_MODIFIED;
+			if (tmp == NULL)
 				return (ENOMEM);
-			}
-			if ((rtree->rt_flags & RT_TRIE_MODIFIED) != 0) {
-				rtree->rt_flags &= ~RT_TRIE_MODIFIED;
-				tmp->rn_count = 0;
-				vm_radix_node_put(tmp);
-				goto restart;
-			}
 			*parentp = tmp;
 			vm_radix_addpage(tmp, index, clev, page);
 			vm_radix_addpage(tmp, m->pindex, clev, m);
@@ -407,21 +383,9 @@ restart:
 	 */
 	newind = rnode->rn_owner;
 	clev = vm_radix_keydiff(newind, index);
-
-	/* See the comments above. */
-	rtree->rt_flags |= RT_INSERT_INPROG;
 	tmp = vm_radix_node_get(vm_radix_trimkey(index, clev + 1), 2, clev);
-	rtree->rt_flags &= ~RT_INSERT_INPROG;
-	if (tmp == NULL) {
-		rtree->rt_flags &= ~RT_TRIE_MODIFIED;
+	if (tmp == NULL)
 		return (ENOMEM);
-	}
-	if ((rtree->rt_flags & RT_TRIE_MODIFIED) != 0) {
-		rtree->rt_flags &= ~RT_TRIE_MODIFIED;
-		tmp->rn_count = 0;
-		vm_radix_node_put(tmp);
-		goto restart;
-	}
 	*parentp = tmp;
 	vm_radix_addpage(tmp, index, clev, page);
 	slot = vm_radix_slot(newind, clev);
@@ -706,20 +670,6 @@ vm_radix_remove(struct vm_radix *rtree, 
 	vm_page_t m;
 	int i, slot;
 
-	/*
-	 * Detect if a page is going to be removed from a trie which is
-	 * already undergoing another trie operation.
-	 * Right now this is only possible for vm_radix_remove() recursing
-	 * into vm_radix_insert().
-	 * If this is the case, the caller must be notified about this
-	 * situation.  It will also takecare to update the RT_TRIE_MODIFIED
-	 * accordingly.
-	 * The RT_TRIE_MODIFIED bit is set here because the remove operation
-	 * will always succeed.
-	 */
-	if ((rtree->rt_flags & RT_INSERT_INPROG) != 0)
-		rtree->rt_flags |= RT_TRIE_MODIFIED;
-
 	rnode = vm_radix_getroot(rtree);
 	if (vm_radix_isleaf(rnode)) {
 		m = vm_radix_topage(rnode);
@@ -774,9 +724,6 @@ vm_radix_reclaim_allnodes(struct vm_radi
 {
 	struct vm_radix_node *root;
 
-	KASSERT((rtree->rt_flags & RT_INSERT_INPROG) == 0,
-	    ("vm_radix_reclaim_allnodes: unexpected trie recursion"));
-
 	root = vm_radix_getroot(rtree);
 	if (root == NULL)
 		return;



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