From owner-svn-src-head@freebsd.org Wed Jul 19 20:52:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15234D7E22A; Wed, 19 Jul 2017 20:52:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF8B16BC26; Wed, 19 Jul 2017 20:52:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6JKqlp3034028; Wed, 19 Jul 2017 20:52:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6JKqlI0034022; Wed, 19 Jul 2017 20:52:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707192052.v6JKqlI0034022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 19 Jul 2017 20:52:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321247 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 321247 X-SVN-Commit-Repository: base 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.23 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: Wed, 19 Jul 2017 20:52:49 -0000 Author: kib Date: Wed Jul 19 20:52:47 2017 New Revision: 321247 URL: https://svnweb.freebsd.org/changeset/base/321247 Log: Add pctrie_init() and vm_radix_init() to initialize generic pctrie and vm_radix trie. Existing vm_radix_init() function is renamed to vm_radix_zinit(). Inlines moved out of the _ headers. Reviewed by: alc, markj (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D11661 Modified: head/sys/sys/_pctrie.h head/sys/sys/pctrie.h head/sys/vm/_vm_radix.h head/sys/vm/vm_object.c head/sys/vm/vm_radix.c head/sys/vm/vm_radix.h Modified: head/sys/sys/_pctrie.h ============================================================================== --- head/sys/sys/_pctrie.h Wed Jul 19 20:49:04 2017 (r321246) +++ head/sys/sys/_pctrie.h Wed Jul 19 20:52:47 2017 (r321247) @@ -38,14 +38,4 @@ struct pctrie { uintptr_t pt_root; }; -#ifdef _KERNEL - -static __inline boolean_t -pctrie_is_empty(struct pctrie *ptree) -{ - - return (ptree->pt_root == 0); -} - -#endif /* _KERNEL */ #endif /* !__SYS_PCTRIE_H_ */ Modified: head/sys/sys/pctrie.h ============================================================================== --- head/sys/sys/pctrie.h Wed Jul 19 20:49:04 2017 (r321246) +++ head/sys/sys/pctrie.h Wed Jul 19 20:52:47 2017 (r321247) @@ -119,5 +119,19 @@ void pctrie_remove(struct pctrie *ptree, uint64_t key size_t pctrie_node_size(void); int pctrie_zone_init(void *mem, int size, int flags); +static __inline void +pctrie_init(struct pctrie *ptree) +{ + + ptree->pt_root = 0; +} + +static __inline boolean_t +pctrie_is_empty(struct pctrie *ptree) +{ + + return (ptree->pt_root == 0); +} + #endif /* _KERNEL */ #endif /* !_SYS_PCTRIE_H_ */ Modified: head/sys/vm/_vm_radix.h ============================================================================== --- head/sys/vm/_vm_radix.h Wed Jul 19 20:49:04 2017 (r321246) +++ head/sys/vm/_vm_radix.h Wed Jul 19 20:52:47 2017 (r321247) @@ -38,14 +38,4 @@ struct vm_radix { uintptr_t rt_root; }; -#ifdef _KERNEL - -static __inline boolean_t -vm_radix_is_empty(struct vm_radix *rtree) -{ - - return (rtree->rt_root == 0); -} - -#endif /* _KERNEL */ #endif /* !__VM_RADIX_H_ */ Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Jul 19 20:49:04 2017 (r321246) +++ head/sys/vm/vm_object.c Wed Jul 19 20:52:47 2017 (r321247) @@ -204,7 +204,7 @@ vm_object_zinit(void *mem, int size, int flags) /* These are true for any object that has been freed */ object->type = OBJT_DEAD; object->ref_count = 0; - object->rtree.rt_root = 0; + vm_radix_init(&object->rtree); object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; @@ -301,7 +301,7 @@ vm_object_init(void) #endif vm_object_zinit, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - vm_radix_init(); + vm_radix_zinit(); } void Modified: head/sys/vm/vm_radix.c ============================================================================== --- head/sys/vm/vm_radix.c Wed Jul 19 20:49:04 2017 (r321246) +++ head/sys/vm/vm_radix.c Wed Jul 19 20:52:47 2017 (r321247) @@ -310,7 +310,7 @@ SYSINIT(vm_radix_reserve_kva, SI_SUB_KMEM, SI_ORDER_TH * Initialize the UMA slab zone. */ void -vm_radix_init(void) +vm_radix_zinit(void) { vm_radix_node_zone = uma_zcreate("RADIX NODE", Modified: head/sys/vm/vm_radix.h ============================================================================== --- head/sys/vm/vm_radix.h Wed Jul 19 20:49:04 2017 (r321246) +++ head/sys/vm/vm_radix.h Wed Jul 19 20:52:47 2017 (r321247) @@ -35,7 +35,6 @@ #ifdef _KERNEL -void vm_radix_init(void); int vm_radix_insert(struct vm_radix *rtree, vm_page_t page); boolean_t vm_radix_is_singleton(struct vm_radix *rtree); vm_page_t vm_radix_lookup(struct vm_radix *rtree, vm_pindex_t index); @@ -44,6 +43,21 @@ vm_page_t vm_radix_lookup_le(struct vm_radix *rtree, v void vm_radix_reclaim_allnodes(struct vm_radix *rtree); vm_page_t vm_radix_remove(struct vm_radix *rtree, vm_pindex_t index); vm_page_t vm_radix_replace(struct vm_radix *rtree, vm_page_t newpage); +void vm_radix_zinit(void); + +static __inline void +vm_radix_init(struct vm_radix *rtree) +{ + + rtree->rt_root = 0; +} + +static __inline boolean_t +vm_radix_is_empty(struct vm_radix *rtree) +{ + + return (rtree->rt_root == 0); +} #endif /* _KERNEL */ #endif /* !_VM_RADIX_H_ */