[SSI] openssi/kernel/fs/proc base.c,1.30,1.31

Roger Tsang <[email protected]> Mon, 25 Oct 2010 05:24:45 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/fs/proc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv6902/fs/proc

Modified Files:
      Tag: OPENSSI-FC
	base.c 
Log Message:
VPROC (#ifdef PROC_LARGE_MAXPIDS):
- Refactor ssi_get_tgid_list() to do concurrent async requests and buffer the PIDs list for each node in the cluster.
- Revert PROC_MAXPIDS value to 20 (the default in Linux base). filldir() in proc_pid_readdir() stops at around 20 entries.
- Reduce VPROC_MAXPIDS value so that internal pid_list[] cache and related proc_readdir_cookie structure fit within one memory page. Reduce memory pressure. Remove large kmalloc() call in proc_pid_readdir().
- Fix ssi_get_tgid_list() skips remaining nodes in the cluster if "start_node" in struct proc_root_readdir_cookie is not found in CLMS node list. This can happen when the next node ("start_node") goes down while the system is reading the list of PIDs. Affects userspace accessing procfs and is not in localview mode.

 cluster/ssi/vproc/procfs_subr.c |  285 ++++++++++++++++++++++++++++----
 fs/proc/base.c                  |   31 +--
 2 files changed, 267 insertions(+), 49 deletions(-)


Index: base.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/fs/proc/base.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- base.c	25 Oct 2010 04:34:58 -0000	1.30
+++ base.c	25 Oct 2010 05:24:43 -0000	1.31
@@ -2652,7 +2652,10 @@
 }
 
 #define PROC_NUMBUF 10
+#ifndef CONFIG_SSI
+/* SSI: Moved to cluster/procfs.h */
 #define PROC_MAXPIDS 20
+#endif /* !CONFIG_SSI */
 
 /*
  * Get a few tgid's to return for filldir - we need to hold the
@@ -2728,17 +2731,14 @@
 /* for the /proc/ directory itself, after non-process stuff has been done */
 int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
 {
-#ifdef PROC_LARGE_MAXPIDS
-	unsigned int __tgid_array[PROC_MAXPIDS];
-	unsigned int *tgid_array;
-	int localview = ssi_get_localview();
-#else
 	unsigned int tgid_array[PROC_MAXPIDS];
-#endif
 	char buf[PROC_NUMBUF];
 	unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
 	unsigned int nr_tgids, i;
 	int next_tgid;
+#ifdef PROC_LARGE_MAXPIDS
+	int localview = ssi_get_localview();
+#endif
 
 	if (!nr) {
 		ino_t ino = fake_ino(0,PROC_TGID_INO);
@@ -2753,23 +2753,14 @@
 	 */
 	next_tgid = filp->f_version;
 	filp->f_version = 0;
-#ifdef PROC_LARGE_MAXPIDS
-	if (!localview) {
-		tgid_array = kmalloc(VPROC_MAXPIDS *
-					sizeof(unsigned int), GFP_KERNEL);
-		if (!tgid_array)
-			return -ENOMEM;
-	} else
-		tgid_array = __tgid_array;
-#endif
 	for (;;) {
 #ifdef CONFIG_SSI
-		/* SSI_XXX: ssi_get_tgid_list() wasn't necessarily designed 
-		 * 	    to be called in a loop like this
-		 */
 #ifdef PROC_LARGE_MAXPIDS
 		if (!localview) {
 #else
+		/* SSI_XXX: ssi_get_tgid_list() wasn't necessarily designed
+		 * 	    to be called in a loop like this
+		 */
 		if ( !PVP(current->p_vproc)->pvp_localview ) {
 #endif
 			/*
@@ -2815,10 +2806,6 @@
 		}
 	}
 out:
-#ifdef PROC_LARGE_MAXPIDS
-	if (!localview)
-		kfree(tgid_array);
-#endif
 	return 0;
 }
 


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev