From 44f13d8feb527fb982064469e513c5a0c9355d03 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 14 Apr 2011 14:11:22 -0500 Subject: [PATCH] RX: Remove allocation counters Remove the osi_alloccnt and osi_allocsize counters, and the associated osi_alloc_mutex. These counters are pretty useless since nothing looks at them, and their use of a mutex requires Rx to be initialized before XDR can be used. Removing them lifts this restriction. Change-Id: I22fa1335b6d34675d37cca41a2c393b9c20d3d24 Reviewed-on: http://gerrit.openafs.org/4478 Reviewed-by: Simon Wilkinson Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/rx/rx.c | 2 -- src/rx/rx_misc.c | 23 ----------------------- 2 files changed, 25 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 42069de..fc89e8d 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -166,7 +166,6 @@ extern afs_kmutex_t des_random_mutex; extern afs_kmutex_t rx_clock_mutex; extern afs_kmutex_t rxi_connCacheMutex; extern afs_kmutex_t rx_event_mutex; -extern afs_kmutex_t osi_malloc_mutex; extern afs_kmutex_t event_handler_mutex; extern afs_kmutex_t listener_mutex; extern afs_kmutex_t rx_if_init_mutex; @@ -195,7 +194,6 @@ rxi_InitPthread(void) MUTEX_INIT(&epoch_mutex, "epoch", MUTEX_DEFAULT, 0); MUTEX_INIT(&rx_init_mutex, "init", MUTEX_DEFAULT, 0); MUTEX_INIT(&rx_event_mutex, "event", MUTEX_DEFAULT, 0); - MUTEX_INIT(&osi_malloc_mutex, "malloc", MUTEX_DEFAULT, 0); MUTEX_INIT(&event_handler_mutex, "event handler", MUTEX_DEFAULT, 0); MUTEX_INIT(&rxi_connCacheMutex, "conn cache", MUTEX_DEFAULT, 0); MUTEX_INIT(&listener_mutex, "listener", MUTEX_DEFAULT, 0); diff --git a/src/rx/rx_misc.c b/src/rx/rx_misc.c index c01b857..9ad279b 100644 --- a/src/rx/rx_misc.c +++ b/src/rx/rx_misc.c @@ -84,21 +84,6 @@ ntoh_syserr_conv(int code) */ #ifndef osi_alloc -#ifdef AFS_PTHREAD_ENV -/* - * This mutex protects the following global variables: - * osi_alloccnt - * osi_allocsize - */ - -afs_kmutex_t osi_malloc_mutex; -#define LOCK_MALLOC_STATS MUTEX_ENTER(&osi_malloc_mutex); -#define UNLOCK_MALLOC_STATS MUTEX_EXIT(&osi_malloc_mutex); -#else -#define LOCK_MALLOC_STATS -#define UNLOCK_MALLOC_STATS -#endif /* AFS_PTHREAD_ENV */ -long osi_alloccnt = 0, osi_allocsize = 0; static const char memZero; char * osi_alloc(afs_int32 x) @@ -109,10 +94,6 @@ osi_alloc(afs_int32 x) */ if (x == 0) return (char *)&memZero; - LOCK_MALLOC_STATS; - osi_alloccnt++; - osi_allocsize += x; - UNLOCK_MALLOC_STATS; return (char *)(mem_alloc(x)); } @@ -121,10 +102,6 @@ osi_free(char *x, afs_int32 size) { if ((x == &memZero) || !x) return 0; - LOCK_MALLOC_STATS; - osi_alloccnt--; - osi_allocsize -= size; - UNLOCK_MALLOC_STATS; mem_free(x, size); return 0; } -- 1.9.4