Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170986750
D45396.id139175.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45396.id139175.diff
View Options
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1851,9 +1851,6 @@
VM_OBJECT_ASSERT_WLOCKED(new_object);
KASSERT(m->ref_count != 0, ("vm_page_rename: page %p has no refs", m));
- mpred = vm_radix_lookup_le(&new_object->rtree, new_pindex);
- KASSERT(mpred == NULL || mpred->pindex != new_pindex,
- ("vm_page_rename: pindex already renamed"));
/*
* Create a custom version of vm_page_insert() which does not depend
@@ -1862,7 +1859,7 @@
*/
opidx = m->pindex;
m->pindex = new_pindex;
- if (vm_radix_insert(&new_object->rtree, m)) {
+ if (vm_radix_insert_lookup_lt(&new_object->rtree, m, &mpred)) {
m->pindex = opidx;
return (1);
}
diff --git a/sys/vm/vm_radix.h b/sys/vm/vm_radix.h
--- a/sys/vm/vm_radix.h
+++ b/sys/vm/vm_radix.h
@@ -69,6 +69,26 @@
return (VM_RADIX_PCTRIE_INSERT(&rtree->rt_trie, page));
}
+/*
+ * Insert the page into the vm_radix tree with its pindex as the key. Panic if
+ * the pindex already exists. Return zero on success or a non-zero error on
+ * memory allocation failure. Set the out parameter mpred to the previous page
+ * in the tree as if found by a previous call to vm_radix_lookup_le with the
+ * new page pindex.
+ */
+static __inline int
+vm_radix_insert_lookup_lt(struct vm_radix *rtree, vm_page_t page,
+ vm_page_t *mpred)
+{
+ int error;
+
+ error = VM_RADIX_PCTRIE_INSERT_LOOKUP_LE(&rtree->rt_trie, page, mpred);
+ if (__predict_false(error == EEXIST))
+ panic("vm_radix_insert_lookup_lt: page already present, %p",
+ *mpred);
+ return (error);
+}
+
/*
* Returns the value stored at the index assuming there is an external lock.
*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 9, 12:53 AM (6 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38550843
Default Alt Text
D45396.id139175.diff (1 KB)
Attached To
Mode
D45396: vm_radix: define vm_radix_insert_lookup_lt and use in vm_page_rename
Attached
Detach File
Event Timeline
Log In to Comment