From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Liu Subject: [PATCH 03/14] tmem: cleanup: drop unneeded client/pool initialization Date: Wed, 18 Dec 2013 14:52:30 +0800 Message-ID: <1387349561-27923-4-git-send-email-bob.liu@oracle.com> References: <1387349561-27923-1-git-send-email-bob.liu@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VtB1H-0006PD-Ef for xen-devel@lists.xenproject.org; Wed, 18 Dec 2013 06:54:11 +0000 Received: by mail-pd0-f174.google.com with SMTP id y13so7733932pdi.5 for ; Tue, 17 Dec 2013 22:54:07 -0800 (PST) In-Reply-To: <1387349561-27923-1-git-send-email-bob.liu@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: james.harper@bendigoit.com.au, keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org Using xzalloc to alloc client and pool, so some extra initialization are unneeded. Signed-off-by: Bob Liu --- xen/common/tmem.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 362e774..6ed91b4 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -1030,24 +1030,13 @@ static struct tmem_pool * pool_alloc(void) struct tmem_pool *pool; int i; - if ( (pool = xmalloc(struct tmem_pool)) == NULL ) + if ( (pool = xzalloc(struct tmem_pool)) == NULL ) return NULL; for (i = 0; i < OBJ_HASH_BUCKETS; i++) pool->obj_rb_root[i] = RB_ROOT; INIT_LIST_HEAD(&pool->pool_list); INIT_LIST_HEAD(&pool->persistent_page_list); - pool->cur_pgp = NULL; rwlock_init(&pool->pool_rwlock); - pool->pgp_count_max = pool->obj_count_max = 0; - pool->objnode_count = pool->objnode_count_max = 0; - atomic_set(&pool->pgp_count,0); - pool->obj_count = 0; pool->shared_count = 0; - pool->good_puts = pool->puts = pool->dup_puts_flushed = 0; - pool->dup_puts_replaced = pool->no_mem_puts = 0; - pool->found_gets = pool->gets = 0; - pool->flushs_found = pool->flushs = 0; - pool->flush_objs_found = pool->flush_objs = 0; - pool->is_dying = 0; return pool; } @@ -1216,15 +1205,9 @@ static struct client *client_create(domid_t cli_id) for ( i = 0; i < MAX_GLOBAL_SHARED_POOLS; i++) client->shared_auth_uuid[i][0] = client->shared_auth_uuid[i][1] = -1L; - client->frozen = 0; client->live_migrating = 0; - client->weight = 0; client->cap = 0; list_add_tail(&client->client_list, &global_client_list); INIT_LIST_HEAD(&client->ephemeral_page_list); INIT_LIST_HEAD(&client->persistent_invalidated_list); - client->cur_pgp = NULL; - client->eph_count = client->eph_count_max = 0; - client->total_cycles = 0; client->succ_pers_puts = 0; - client->succ_eph_gets = 0; client->succ_pers_gets = 0; tmem_client_info("ok\n"); return client; -- 1.7.10.4