[SSI] openssi/kernel/include/cluster/ssi/ipc unixnm.h,1.17,1.18
Roger Tsang <[email protected]> Fri, 05 Mar 2010 06:20:48 +0000
| Newsgroups | gmane.linux.cluster.ssic.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ssic-linux/openssi/kernel/include/cluster/ssi/ipc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7491/kernel/include/cluster/ssi/ipc
Modified Files:
Tag: OPENSSI-FC
unixnm.h
Log Message:
RMTUNIX (#ifdef IPC_STALE_RMTUNIX_CACHE_FIX):
- Optimize away rsk_spinlock in rmtunix_socket_info struct reference counting
code. Use atomic_test_and_add().
RMTUNIX (#ifdef RMTUNIX_SOCK_INFO_CACHE):
- Regression:
- rmtunixsvr_stream_connect_callback() error path calling kfree() on
kmem_cache object.
- ssi_unix_find_socket_byinode() error path calling kfree() on kmem_cache
object.
- ssi_unix_find_socket_byname() error path calling kfree() on kmem_cache
object.
cluster/ssi/ipc/rmtunix.c | 19 +++++++--------
include/cluster/ssi/ipc/unixnm.h | 39 +++++++------------------------
include/cluster/ssi/unix.h | 16 +++++++++++-
3 files changed, 32 insertions(+), 42 deletions(-)
Index: unixnm.h
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/include/cluster/ssi/ipc/unixnm.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- unixnm.h 27 Oct 2009 03:18:30 -0000 1.17
+++ unixnm.h 5 Mar 2010 06:20:46 -0000 1.18
@@ -50,9 +50,7 @@
unsigned long id;
unsigned long rmtid;
#ifdef IPC_STALE_RMTUNIX_CACHE_FIX
- int rsk_cached;
atomic_t rsk_refcnt;
- SPIN_LOCK_T rsk_spinlock;
#endif
#ifdef RCU_RMTUNIX_CACHE
struct rcu_head rhead;
@@ -157,7 +155,6 @@
if (!rmtunix_ismagic(s))
sock_hold(s); /* RT: for _rmtunix_dealloc() */
info->sk = s;
- info->rsk_cached = 1;
#endif
spin_lock(&rmtunix_cache_listlock);
@@ -180,23 +177,19 @@
{
#ifdef RCU_RMTUNIX_CACHE
struct rmtunix_socket_info *info;
+ char found = 0;
rcu_read_lock();
list_for_each_entry_rcu(info, &rmtunix_cache_list, list) {
- if (info->sk == s) {
- LOCK_SPIN_LOCK(&info->rsk_spinlock);
- if (!info->rsk_cached) {
- UNLOCK_SPIN_LOCK(&info->rsk_spinlock);
- break;
- }
- atomic_inc(&info->rsk_refcnt);
- UNLOCK_SPIN_LOCK(&info->rsk_spinlock);
- rcu_read_unlock();
- return info;
- }
+ if (info->sk != s)
+ continue;
+ if (atomic_test_and_add(1, &info->rsk_refcnt))
+ found = 1;
+ break;
}
rcu_read_unlock();
-#else
+ return found ? info : NULL;
+#else /* RCU_RMTUNIX_CACHE */
struct list_head *cur;
/* Caller must hold rmtunix_cache_listlock */
@@ -206,8 +199,8 @@
if (tmp->sk == s)
return tmp;
}
-#endif
return NULL;
+#endif /* !RCU_RMTUNIX_CACHE */
}
static inline void
@@ -218,18 +211,6 @@
#ifdef RCU_RMTUNIX_CACHE
if (!atomic_dec_and_lock(&info->rsk_refcnt, &rmtunix_cache_listlock))
return;
- if (info->sk) {
- SSI_ASSERT(info->rsk_cached);
- LOCK_SPIN_LOCK(&info->rsk_spinlock);
- if (atomic_read(&info->rsk_refcnt)) {
- UNLOCK_SPIN_LOCK(&info->rsk_spinlock);
- spin_unlock(&rmtunix_cache_listlock);
- return;
- }
- info->rsk_cached = 0;
- UNLOCK_SPIN_LOCK(&info->rsk_spinlock);
- } else
- BUG_ON(info->rsk_cached);
#ifdef DEBUG
--rmtunix_cache_size;
#endif
@@ -242,7 +223,6 @@
spin_unlock(&rmtunix_cache_listlock);
return;
}
- info->rsk_cached = 0;
#endif
/* SSI_XXX: Missing sock_put(info->sk) ? */
info->sk = NULL;
@@ -316,7 +296,6 @@
#ifdef IPC_STALE_RMTUNIX_CACHE_FIX
INIT_LIST_HEAD(&info->list);
atomic_set(&info->rsk_refcnt, 1);
- INIT_SPIN_LOCK(&info->rsk_spinlock);
#endif
#ifdef RCU_RMTUNIX_CACHE
INIT_RCU_HEAD(&info->rhead);
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev