Date: Mon, 9 Apr 2012 17:05:19 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234064 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs vm Message-ID: <201204091705.q39H5JCG070013@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Mon Apr 9 17:05:18 2012 New Revision: 234064 URL: http://svn.freebsd.org/changeset/base/234064 Log: - 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 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/vm/vm_page.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Apr 9 16:18:55 2012 (r234063) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Apr 9 17:05:18 2012 (r234064) @@ -345,10 +345,9 @@ page_lookup(vnode_t *vp, int64_t start, 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; Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Mon Apr 9 16:18:55 2012 (r234063) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Mon Apr 9 17:05:18 2012 (r234064) @@ -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; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Apr 9 16:18:55 2012 (r234063) +++ head/sys/vm/vm_page.c Mon Apr 9 17:05:18 2012 (r234064) @@ -1303,7 +1303,7 @@ vm_page_is_cached(vm_object_t object, vm * 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204091705.q39H5JCG070013>