[SSI] openssi/kernel/cluster/ssi/mosixll load.c,1.15,1.16

Roger Tsang <[email protected]> Wed, 15 Dec 2010 07:59:25 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/mosixll
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv23602/kernel/cluster/ssi/mosixll

Modified Files:
      Tag: OPENSSI-FC
	load.c 
Log Message:
- mosix_calc_process_loads: no need to check whether thread group cpu usage exceeds maximum possible cpu time. condition never reached. reduce unnecessary work.
- mosix_calc_process_loads: fix large value for load field in mm structure if mosix_snap_load() lost the race. when this happens choose() might not pick the most cpu intensive process for migration. regression introduced in CVS tag OPENSSI-FC-1-9-6-PRE51
- mosix_calc_load: fix large "ladd" value if mosix_snap_load() lost the race. Value of "ladd" indirectly affects value of MOSIX load. regression introduced in CVS tag OPENSSI-FC-1-9-6-PRE51
- remove global variables acpuse and cpuse. not used.


Index: load.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/mosixll/load.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- load.c	9 Nov 2010 02:46:03 -0000	1.15
+++ load.c	15 Dec 2010 07:59:23 -0000	1.16
@@ -41,14 +41,11 @@
 #define NEWDATA (VV2-VV1)/VV2   /* weight of new load data */
 
 #ifdef CONFIG_SSI
-/* protect load_ticks, cpuse, load_addr */
+/* protect load_ticks, load_addr */
 static __cacheline_aligned_in_smp DEFINE_SPINLOCK(snap_load_lock);
 
 unsigned long load_adder;    /* accumulator of `running' every clock tick */
 unsigned long load_ticks;    /* # of ticks included in load_adder */
-unsigned long cpuse;         /* # of ticks when CPU was not thrashing */
-
-unsigned long acpuse = MF;   /* long term non-thrashing (non-zero) */
 
 /* protect load_left */
 __cacheline_aligned_in_smp DEFINE_SPINLOCK(load_left_lock);
@@ -119,18 +116,13 @@
 			task_rq_unlock(rq, &flags);
 		} while_each_thread(p, t);
 
-		if (time) {
-			ran = min_t(clock_t,
-				cputime_to_clock_t(time),
-				u_ticks * num_online_cpus());
-		}
+		if (time)
+			ran = cputime_to_clock_t(time);
 
 		task_lock(p);
 		p->mm->load *= DECAY;
-		if (time) {
-			p->mm->load += ran * stable_export *
-					4*NEWDATA / u_ticks;
-		}
+		if (time)
+			p->mm->load += ran * 4*NEWDATA * MF / u_ticks;
 		task_unlock(p);
 		mmput(p->mm);
 	}
@@ -149,7 +141,7 @@
 static unsigned long upper_load = 0;	/* over estimated load */
 static unsigned long accload = 0;	/* accumulated load (*128) */
 static DECLARE_MUTEX(mosix_calc_load_sem);
-	unsigned long ladd, ticks;
+	unsigned long ladd, u_ticks;
 	unsigned long newload;
 #ifdef DEBUG
 	static int display_counter = 0;
@@ -164,17 +156,17 @@
 	/* Disable interrupt to prevent do_mosix_snap_load() */
 	spin_lock_bh(&snap_load_lock);
 
-	ticks = load_ticks;
+	u_ticks = load_ticks;
 	ladd = load_adder;
 	load_adder = load_ticks = 0;
 	spin_unlock_bh(&snap_load_lock);
 
-	if (ticks == 0) {
+	if (u_ticks == 0) {
 		up(&mosix_calc_load_sem);
 		return;
 	}
 
-	ladd *= stable_export;
+	ladd *= stable_export * MF / u_ticks;
 
 	if(ladd * 128 > accload)	/* slowly up */
 		accload = accload * DECAY + ladd * 128 * NEWDATA;
@@ -201,19 +193,18 @@
 
 #ifdef DEBUG
 	if(Tvis)
-		printk("\0337\033[22;55HL=%d,E=%d,R=%lu,U=%d  \0338",
-			(int)newload, (int)export_load, nr_running(),
-			(int)acpuse);
+		printk("\0337\033[22;55HL=%d,E=%d,R=%lu,\0338",
+			(int)newload, (int)export_load, nr_running());
 	if(Tload) {
 		if (!(display_counter = (display_counter + 1) & 0xf))
 			printk("\naccload upper_load\tload_adder\tload_ticks\n");
 		printk("%7d\t%10d\t%10d\t%d\n",
-			(int)accload, (int)upper_load, (int)ladd, (int)ticks);
+			(int)accload, (int)upper_load, (int)ladd, (int)u_ticks);
 	}
 #endif /* DEBUG */
 
 	if (atomic_read(&loadlevel_on))
-		mosix_calc_process_loads(ticks);
+		mosix_calc_process_loads(u_ticks);
 
 #ifdef REXEC_LOADTABLE_FAST
 	__altload = altload(newload, loadinfo[0].speed, loadinfo[0].ncpus);
@@ -358,7 +349,6 @@
 mosix_load_init(void)
 {
 #ifdef CONFIG_SSI
-	cpuse = acpuse = MF * num_online_cpus();
 	load_ticks = MF;	/* fake it to begin with (must be non-zero) */
 	load_adder = nr_running() * MF;
 #else


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d