[SSI] openssi/kernel/cluster/ssi/ipc rmtunix.c,1.28,1.29

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/cluster/ssi/ipc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7491/kernel/cluster/ssi/ipc

Modified Files:
      Tag: OPENSSI-FC
	rmtunix.c 
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: rmtunix.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/ipc/rmtunix.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- rmtunix.c	27 Oct 2009 03:18:29 -0000	1.28
+++ rmtunix.c	5 Mar 2010 06:20:46 -0000	1.29
@@ -102,7 +102,6 @@
 		info->sk = NULL;
 #ifdef IPC_STALE_RMTUNIX_CACHE_FIX
 	}
-	DEINIT_SPIN_LOCK(&info->rsk_spinlock);
 #endif
 	info->magic = 0;
 #ifdef RMTUNIX_SOCK_INFO_CACHE
@@ -179,18 +178,14 @@
 	list_for_each_entry_rcu(info, &rmtunix_cache_list, list) {
 		if (info->id != id)
 			continue;
-		LOCK_SPIN_LOCK(&info->rsk_spinlock);
-		if (!info->rsk_cached) {
-			UNLOCK_SPIN_LOCK(&info->rsk_spinlock);
+		if (!info->sk)
 			break;
-		}
-		if ((sk = info->sk))
-			atomic_inc(&info->rsk_refcnt);
-		UNLOCK_SPIN_LOCK(&info->rsk_spinlock);
+		if (atomic_test_and_add(1, &info->rsk_refcnt))
+			sk = info->sk;
 		break;
 	}
 	rcu_read_unlock();
-#else
+#else /* RCU_RMTUNIX_CACHE */
 	spin_lock(&rmtunix_cache_listlock);
 	list_for_each(cur, &rmtunix_cache_list) {
 		struct rmtunix_socket_info *info = list_entry(cur,
@@ -201,7 +196,7 @@
 		}
 	}
 	spin_unlock(&rmtunix_cache_listlock);
-#endif
+#endif /* !RCU_RMTUNIX_CACHE */
 
 	if (!sk)
 		goto out;
@@ -749,7 +744,11 @@
 
 out:
 	if (err && info)
+#ifdef RMTUNIX_SOCK_INFO_CACHE
+		rmtunix_free(&info->rhead);
+#else
 		kfree(info);
+#endif
 	if (sk)
 		sock_put(sk);
 	ssi_procstate_set(&save_pstate);


------------------------------------------------------------------------------
Download Intel&#174; 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