From owner-p4-projects@FreeBSD.ORG Thu Apr 20 14:40:30 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EB17116A402; Thu, 20 Apr 2006 14:40:29 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA9C316A400 for ; Thu, 20 Apr 2006 14:40:29 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9422E43D45 for ; Thu, 20 Apr 2006 14:40:29 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3KEeTsJ059827 for ; Thu, 20 Apr 2006 14:40:29 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3KEeTa6059821 for perforce@freebsd.org; Thu, 20 Apr 2006 14:40:29 GMT (envelope-from millert@freebsd.org) Date: Thu, 20 Apr 2006 14:40:29 GMT Message-Id: <200604201440.k3KEeTa6059821@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 95680 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 14:40:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=95680 Change 95680 by millert@millert_g5tower on 2006/04/20 14:40:00 Use a zone allocator for the avtab cache. Affected files ... .. //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/ss/avtab.c#7 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/ss/avtab.c#7 (text+ko) ==== @@ -20,19 +20,24 @@ #include #include +#include + #define AVTAB_HASH(keyp) \ ((keyp->target_class + \ (keyp->target_type << 2) + \ (keyp->source_type << 9)) & \ AVTAB_HASH_MASK) +zone_t avtab_node_cachep; + static struct avtab_node* avtab_insert_node(struct avtab *h, int hvalue, struct avtab_node * prev, struct avtab_node * cur, struct avtab_key *key, struct avtab_datum *datum) { struct avtab_node * newnode; - newnode = kmalloc(sizeof(*newnode), GFP_KERNEL); + /* XXX - should use non-blocking zalloc */ + newnode = (struct avtab_node *)zalloc(avtab_node_cachep); if (newnode == NULL) return NULL; memset(newnode, 0, sizeof(struct avtab_node)); @@ -464,17 +469,13 @@ void avtab_cache_init(void) { -/* XXX - use zone allocator */ -#ifdef SEBSDnotyet - avtab_node_cachep = kmem_cache_create("avtab_node", - sizeof(struct avtab_node), - 0, SLAB_PANIC, NULL, NULL); -#endif + // XXX - we can probably do a better job of packing items into the zone + avtab_node_cachep = zinit(sizeof(struct avtab_node), + 4096 * sizeof(struct avtab_node), 16 * sizeof(struct avtab_node), + "avtab node"); } void avtab_cache_destroy(void) { -#ifdef SEBSDnotyet - kmem_cache_destroy (avtab_node_cachep); -#endif + /* Darwin does not provide a way to destroy a zone. */ }