svn commit: r226954 - user/attilio/vmcontention/sys/kern
Jeff Roberson
jeff at FreeBSD.org
Mon Oct 31 00:10:12 UTC 2011
Author: jeff
Date: Mon Oct 31 00:10:11 2011
New Revision: 226954
URL: http://svn.freebsd.org/changeset/base/226954
Log:
- Convert object->cache usage to the radix tree.
Modified:
user/attilio/vmcontention/sys/kern/uipc_shm.c
Modified: user/attilio/vmcontention/sys/kern/uipc_shm.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/uipc_shm.c Sun Oct 30 23:31:03 2011 (r226953)
+++ user/attilio/vmcontention/sys/kern/uipc_shm.c Mon Oct 31 00:10:11 2011 (r226954)
@@ -289,10 +289,23 @@ shm_dotruncate(struct shmfd *shmfd, off_
* a page swapped out to disk?
*/
if ((length & PAGE_MASK) &&
- (m = vm_page_lookup(object, OFF_TO_IDX(length))) != NULL &&
- m->valid != 0) {
- int base = (int)length & PAGE_MASK;
- int size = PAGE_SIZE - base;
+ (m = vm_radix_lookup(&object->rtree, OFF_TO_IDX(length),
+ VM_RADIX_ANY)) != NULL) {
+ int base;
+ int size;
+
+ if (m->flags & PG_CACHED) {
+ mtx_lock(&vm_page_queue_free_mtx);
+ if (m->object == object)
+ vm_page_cache_remove(m);
+ mtx_unlock(&vm_page_queue_free_mtx);
+ goto out;
+ }
+ if (m->valid != 0 || m->object != object)
+ goto out;
+
+ base = (int)length & PAGE_MASK;
+ size = PAGE_SIZE - base;
pmap_zero_page_area(m, base, size);
@@ -311,10 +324,6 @@ shm_dotruncate(struct shmfd *shmfd, off_
base = roundup2(base, DEV_BSIZE);
vm_page_clear_dirty(m, base, PAGE_SIZE - base);
- } else if ((length & PAGE_MASK) &&
- __predict_false(object->cache != NULL)) {
- vm_page_cache_free(object, OFF_TO_IDX(length),
- nobjsize);
}
} else {
@@ -326,6 +335,7 @@ shm_dotruncate(struct shmfd *shmfd, off_
}
object->charge += delta;
}
+out:
shmfd->shm_size = length;
mtx_lock(&shm_timestamp_lock);
vfs_timestamp(&shmfd->shm_ctime);
More information about the svn-src-user
mailing list