From owner-svn-src-all@FreeBSD.ORG Mon Apr 9 17:05:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 755ED106566B; Mon, 9 Apr 2012 17:05:19 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 464208FC08; Mon, 9 Apr 2012 17:05:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q39H5JmH070017; Mon, 9 Apr 2012 17:05:19 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q39H5JCG070013; Mon, 9 Apr 2012 17:05:19 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201204091705.q39H5JCG070013@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Apr 2012 17:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234064 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2012 17:05:19 -0000 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);