diff options
author | Alan Cox <alc@FreeBSD.org> | 2016-12-08 04:29:29 +0000 |
---|---|---|
committer | Alan Cox <alc@FreeBSD.org> | 2016-12-08 04:29:29 +0000 |
commit | e94965d82ee36be405158472bb0f09b7e074e703 (patch) | |
tree | f966d72e838f7cb3633ec29dff8609f7a808da13 /sys/vm/vm_page.c | |
parent | 3c606f671e468013436c22c026c7b2a2e6f16078 (diff) | |
download | src-e94965d82ee36be405158472bb0f09b7e074e703.tar.gz src-e94965d82ee36be405158472bb0f09b7e074e703.zip |
Previously, vm_radix_remove() would panic if the radix trie didn't
contain a vm_page_t at the specified index. However, with this
change, vm_radix_remove() no longer panics. Instead, it returns NULL
if there is no vm_page_t at the specified index. Otherwise, it
returns the vm_page_t. The motivation for this change is that it
simplifies the use of radix tries in the amd64, arm64, and i386 pmap
implementations. Instead of performing a lookup before every remove,
the pmap can simply perform the remove.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D8708
Notes
Notes:
svn path=/head/; revision=309703
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r-- | sys/vm/vm_page.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 54e43ca5a3a2..34841e019aff 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1241,9 +1241,8 @@ vm_page_insert_radixdone(vm_page_t m, vm_object_t object, vm_page_t mpred) /* * vm_page_remove: * - * Removes the given mem entry from the object/offset-page - * table and the object page list, but do not invalidate/terminate - * the backing store. + * Removes the specified page from its containing object, but does not + * invalidate any backing storage. * * The object must be locked. The page must be locked if it is managed. */ @@ -1251,6 +1250,7 @@ void vm_page_remove(vm_page_t m) { vm_object_t object; + vm_page_t mrem; if ((m->oflags & VPO_UNMANAGED) == 0) vm_page_assert_locked(m); @@ -1259,11 +1259,12 @@ vm_page_remove(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(object); if (vm_page_xbusied(m)) vm_page_xunbusy_maybelocked(m); + mrem = vm_radix_remove(&object->rtree, m->pindex); + KASSERT(mrem == m, ("removed page %p, expected page %p", mrem, m)); /* * Now remove from the object's list of backed pages. */ - vm_radix_remove(&object->rtree, m->pindex); TAILQ_REMOVE(&object->memq, m, listq); /* |