diff options
author | attilio <attilio@FreeBSD.org> | 2012-04-09 17:05:18 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2012-04-09 17:05:18 +0000 |
commit | 628004ddfb14301b6958eff7fd70dc889f1b6f5e (patch) | |
tree | 8aac67e7dc8be50da7ef586592b2086e9064bbc7 /sys | |
parent | b5a7a06de171e39df8cc4e199c50fe0697127894 (diff) | |
download | FreeBSD-src-628004ddfb14301b6958eff7fd70dc889f1b6f5e.zip FreeBSD-src-628004ddfb14301b6958eff7fd70dc889f1b6f5e.tar.gz |
- Introduce a cache-miss optimization for consistency with other
accesses of the cache member of vm_object objects.
- Use novel vm_page_is_cached() for checks outside of the vm subsystem.
Reviewed by: alc
MFC after: 2 weeks
X-MFC: r234039
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 3 | ||||
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/vm/vm_page.c | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index e22e552..2f3f2a7 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -345,10 +345,9 @@ page_lookup(vnode_t *vp, int64_t start, int64_t off, int64_t nbytes) vm_page_busy(pp); vm_page_undirty(pp); } else { - if (__predict_false(obj->cache != NULL)) { + if (vm_page_is_cached(obj, OFF_TO_IDX(start))) vm_page_cache_free(obj, OFF_TO_IDX(start), OFF_TO_IDX(start) + 1); - } pp = NULL; } break; diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 5c86c36..be42f9a 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -662,7 +662,7 @@ lookupvpg: VM_OBJECT_UNLOCK(vobj); error = uiomove_fromphys(&vpg, offset, tlen, uio); } else { - if (__predict_false(vobj->cache != NULL)) + if (vm_page_is_cached(vobj, idx)) vm_page_cache_free(vobj, idx, idx + 1); VM_OBJECT_UNLOCK(vobj); vpg = NULL; diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 565ac99..65bb701 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1303,7 +1303,7 @@ vm_page_is_cached(vm_object_t object, vm_pindex_t pindex) * exist. */ VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - if (object->cache == NULL) + if (__predict_true(object->cache == NULL)) return (FALSE); mtx_lock(&vm_page_queue_free_mtx); m = vm_page_cache_lookup(object, pindex); |