From owner-svn-src-head@FreeBSD.ORG Tue Mar 26 17:30:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E5596BA2; Tue, 26 Mar 2013 17:30:40 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D88A6D71; Tue, 26 Mar 2013 17:30:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2QHUepr044809; Tue, 26 Mar 2013 17:30:40 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2QHUeTw044808; Tue, 26 Mar 2013 17:30:40 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201303261730.r2QHUeTw044808@svn.freebsd.org> From: Alan Cox Date: Tue, 26 Mar 2013 17:30:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248728 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Mar 2013 17:30:41 -0000 Author: alc Date: Tue Mar 26 17:30:40 2013 New Revision: 248728 URL: http://svnweb.freebsd.org/changeset/base/248728 Log: Introduce vm_radix_isleaf() and use it in a couple places. As compared to using vm_radix_node_page() == NULL, the compiler is able to generate one less conditional branch when vm_radix_isleaf() is used. More use cases involving the inner loops of vm_radix_insert(), vm_radix_lookup{,_ge,_le}(), and vm_radix_remove() will follow. Reviewed by: attilio Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_radix.c Modified: head/sys/vm/vm_radix.c ============================================================================== --- head/sys/vm/vm_radix.c Tue Mar 26 16:38:03 2013 (r248727) +++ head/sys/vm/vm_radix.c Tue Mar 26 17:30:40 2013 (r248728) @@ -189,6 +189,16 @@ vm_radix_setroot(struct vm_radix *rtree, } /* + * Returns TRUE if the specified radix node is a leaf and FALSE otherwise. + */ +static __inline boolean_t +vm_radix_isleaf(struct vm_radix_node *rnode) +{ + + return (((uintptr_t)rnode & VM_RADIX_ISLEAF) != 0); +} + +/* * Returns the associated page extracted from rnode if available, * and NULL otherwise. */ @@ -315,7 +325,7 @@ vm_radix_reclaim_allnodes_int(struct vm_ for (slot = 0; rnode->rn_count != 0; slot++) { if (rnode->rn_child[slot] == NULL) continue; - if (vm_radix_node_page(rnode->rn_child[slot]) == NULL) + if (!vm_radix_isleaf(rnode->rn_child[slot])) vm_radix_reclaim_allnodes_int(rnode->rn_child[slot]); rnode->rn_child[slot] = NULL; rnode->rn_count--; @@ -454,7 +464,7 @@ vm_radix_insert(struct vm_radix *rtree, __func__, clev, rnode->rn_clev)); slot = vm_radix_slot(index, rnode->rn_clev); tmp = rnode->rn_child[slot]; - KASSERT(tmp != NULL && vm_radix_node_page(tmp) == NULL, + KASSERT(tmp != NULL && !vm_radix_isleaf(tmp), ("%s: unexpected lookup interruption", __func__)); if (tmp->rn_clev > clev) break;