[SSI] openssi/kernel/cluster/ssi/vproc dvp_move.c, 1.19, 1.20 rproc_cli_pproc.c, 1.26, 1.27 rproc_cli_vproc.c, 1.12, 1.13 rproc_svr_pproc.c, 1.30, 1.31
Roger Tsang <[email protected]> Tue, 09 Nov 2010 02:08:54 +0000
| Newsgroups | gmane.linux.cluster.ssic.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv6896/cluster/ssi/vproc
Modified Files:
Tag: OPENSSI-FC
dvp_move.c rproc_cli_pproc.c rproc_cli_vproc.c
rproc_svr_pproc.c
Log Message:
VPROC:
- reopen_unload_msg: add debug messages.
- reopen_unload_msg: optimize away sys_close() calls.
- common_data_load_msg: optimize away certain fields per common_data_unload_msg().
- add_thread_group: obtain number of threads from shared signal reference count instead of traversing list of threads.
cluster/ssi/vproc/dvp_move.c | 18 ++--
cluster/ssi/vproc/rproc_cli_pproc.c | 115 +++++++++++++++-------------
cluster/ssi/vproc/rproc_cli_vproc.c | 4
cluster/ssi/vproc/rproc_svr_pproc.c | 24 +++--
4 files changed, 91 insertions(+), 70 deletions(-)
Index: dvp_move.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_move.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- dvp_move.c 25 Oct 2010 05:58:14 -0000 1.19
+++ dvp_move.c 9 Nov 2010 02:08:51 -0000 1.20
@@ -1056,8 +1056,8 @@
read_lock(&tasklist_lock);
#ifdef VPROC_MIGRATE_THREAD_GROUP_FIX
- t = p;
- while_each_thread(p, t) count++;
+ if (p->signal)
+ count = atomic_read(&p->signal->count) - 1; /* skip self */
#else
for_each_process(t) {
if (t == p)
@@ -1142,10 +1142,10 @@
count = i;
break;
}
-
+ /* encountered more threads */
kfree(pidp);
count = i;
- yield();
+ cond_resched();
}
for (i = 0; i < count; i++) {
tmpret = setup_pid_move(h, pidp[i], leader);
@@ -1163,8 +1163,8 @@
if (h->mh_state == PM_QUIESCED && retval == 0) {
spin_unlock(&h->mh_lock);
- count++;
#ifndef VPROC_MIGRATE_THREAD_GROUP_FIX
+ count++;
if (atomic_read(&p->mm->mm_users) != count ||
atomic_read(&p->fs->count) != count ||
atomic_read(&p->files->count) != count ||
@@ -1179,13 +1179,13 @@
}
#endif
if (leader > 0) {
- tcount = 1;
- t = p;
-
read_lock(&tasklist_lock);
- while_each_thread(p, t) tcount++;
+ tcount = p->signal ? atomic_read(&p->signal->count) : 0;
read_unlock(&tasklist_lock);
+#ifdef VPROC_MIGRATE_THREAD_GROUP_FIX
+ count++;
+#endif
if (tcount != count) {
printk(KERN_DEBUG
"%s: group(%d)/share imbalance %d/%d\n",
Index: rproc_cli_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_cli_pproc.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- rproc_cli_pproc.c 25 Oct 2010 06:08:00 -0000 1.26
+++ rproc_cli_pproc.c 9 Nov 2010 02:08:51 -0000 1.27
@@ -357,7 +357,6 @@
struct reopendata *rdp;
fd_data *fddp;
struct files_struct *files = current->files;
- int open_count = 0; /* number of open files */
struct file *file;
int reop_flag = 0;
unsigned int fd;
@@ -365,11 +364,11 @@
*rdpp = NULL;
- error = -ENOMEM;
- rdp = (struct reopendata *) kzmalloc(sizeof(*rdp), GFP_USER);
- if (!rdp)
+ rdp = kmalloc(sizeof(*rdp), GFP_KERNEL);
+ if (!rdp) {
+ error = -ENOMEM;
goto out;
-
+ }
rdp->next_fd = files->next_fd;
rdp->fd_count = 0;
rdp->fd_info = NULL;
@@ -386,19 +385,23 @@
continue;
if (FD_ISSET(fd, files->open_fds))
- open_count++;
+ rdp->fd_count++;
}
#ifdef REOPDEBUG
- printk("open_files_load_msg: Number of open fds = %d\n", open_count);
+ printk("open_files_load_msg: Number of open fds = %d\n", rdp->fd_count);
#endif
+ if (rdp->fd_count == 0) {
+ *rdpp = rdp;
+ error = 0;
+ goto out;
+ }
- error = -ENOMEM;
- rdp->fd_count = open_count;
- fddp = (fd_data *) kzmalloc(open_count * sizeof(*fddp), GFP_USER);
- if (!fddp)
+ fddp = kzmalloc(rdp->fd_count * sizeof(*fddp), GFP_KERNEL);
+ if (!fddp) {
+ error = -ENOMEM;
goto free_out;
-
+ }
rdp->fd_info = fddp;
error = 0;
@@ -536,12 +539,12 @@
unsigned long flags;
runqueue_t *rq;
- error = -ENOMEM;
- *comm_datapp = NULL;
- comm_datap = kzmalloc(sizeof(rvp_common_data), GFP_USER);
- if (!comm_datap)
+ comm_datap = kzmalloc(sizeof(*comm_datap), GFP_KERNEL);
+ if (!comm_datap) {
+ error = -ENOMEM;
+ *comm_datapp = NULL;
goto out;
-
+ }
*comm_datapp = comm_datap;
/*
@@ -566,36 +569,40 @@
comm_datap->comm_exit_code = t->exit_code;
comm_datap->comm_exit_signal = t->exit_signal;
- comm_datap->comm_pdeath_signal = t->pdeath_signal;
comm_datap->comm_personality = t->personality;
- comm_datap->comm_did_exec = t->did_exec;
- comm_datap->comm_tgid = t->tgid;
- comm_datap->comm_clear_child_tid = (arch_ulong)t->clear_child_tid;
- /* process times & timers */
- comm_datap->comm_it_real_value = t->it_real_value;
- comm_datap->comm_it_prof_value = t->it_prof_value;
- comm_datap->comm_it_virt_value = t->it_virt_value;
- comm_datap->comm_it_real_incr = t->it_real_incr;
- comm_datap->comm_it_prof_incr = t->it_prof_incr;
- comm_datap->comm_it_virt_incr = t->it_virt_incr;
+
+ if (RVP_ISMIGRATE(optype))
+ comm_datap->comm_clear_child_tid = (arch_ulong)t->clear_child_tid;
if (!RVP_ISRFORK(optype)) {
+ comm_datap->comm_pdeath_signal = t->pdeath_signal;
+ comm_datap->comm_did_exec = t->did_exec;
+ comm_datap->comm_tgid = t->tgid;
+ /* process times & timers */
+ comm_datap->comm_it_real_value = t->it_real_value;
+ comm_datap->comm_it_prof_value = t->it_prof_value;
+ comm_datap->comm_it_virt_value = t->it_virt_value;
+ comm_datap->comm_it_real_incr = t->it_real_incr;
+ comm_datap->comm_it_prof_incr = t->it_prof_incr;
+ comm_datap->comm_it_virt_incr = t->it_virt_incr;
+
if (del_timer_sync(&t->real_timer)) {
comm_datap->comm_real_timer_set = 1;
comm_datap->comm_real_timer_expires =
t->real_timer.expires - jiffies;
}
- }
- comm_datap->comm_utime = t->utime;
- comm_datap->comm_stime = t->stime;
- comm_datap->comm_nvcsw = t->nvcsw;
- comm_datap->comm_nivcsw = t->nivcsw;
- comm_datap->comm_start_time =
- timespec_to_jiffies(&t->start_time) - jiffies;
+ comm_datap->comm_utime = t->utime;
+ comm_datap->comm_stime = t->stime;
+ comm_datap->comm_nvcsw = t->nvcsw;
+ comm_datap->comm_nivcsw = t->nivcsw;
- /* stats */
- comm_datap->comm_min_flt = t->min_flt;
- comm_datap->comm_maj_flt = t->maj_flt;
+ comm_datap->comm_start_time =
+ timespec_to_jiffies(&t->start_time) - jiffies;
+
+ /* stats */
+ comm_datap->comm_min_flt = t->min_flt;
+ comm_datap->comm_maj_flt = t->maj_flt;
+ }
/* process credentials */
comm_datap->comm_uid = t->uid;
@@ -631,16 +638,20 @@
* Package the process's root and current working directories
* for export to the remote node.
*/
- error = export_dirs(comm_datap, RVP_TO_REOP_OP(optype));
- if (error)
- goto out;
+ if (optype != RVP_MIGRATE_THREAD) {
+ error = export_dirs(comm_datap, RVP_TO_REOP_OP(optype));
+ if (error)
+ goto out;
+ }
/*
* Package information about open files for reopen on remote node.
*/
- error = reopen_load_msg(&comm_datap->comm_reopendata, optype);
- if (error)
- goto out;
+ if (optype != RVP_MIGRATE_THREAD) {
+ error = reopen_load_msg(&comm_datap->comm_reopendata, optype);
+ if (error)
+ goto out;
+ }
/* signal handlers */
error = signal_load_msg(comm_datap, optype);
@@ -852,22 +863,22 @@
*/
int ssi_recalc_locks(struct task_struct *task, int optype)
{
- struct files_struct *files = NULL;
- struct inode *inode;
+ struct files_struct *files;
+ struct inode *inode;
struct file *fp;
- int i;
- int locks, noncfs_locks;
+ struct file_lock *fl;
+ int i, noncfs_locks;
+ //int locks;
if (RVP_ISRFORK(optype))
return 0;
- locks = 0;
+ //locks = 0;
noncfs_locks = 0;
files = task->files;
if (files) {
lock_kernel(); /* for i_flock list */
spin_lock(&files->file_lock);
for(i=0; i < files->max_fds; i++) {
- struct file_lock *fl;
fp = files->fd[i];
if (!fp)
continue;
@@ -879,7 +890,7 @@
/* Now we allow migration with CFS locks */
if (!cfs_inode_is_cfs(inode))
noncfs_locks++;
- locks++;
+ //locks++;
}
}
spin_unlock(&files->file_lock);
Index: rproc_svr_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_svr_pproc.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- rproc_svr_pproc.c 25 Oct 2010 06:08:00 -0000 1.30
+++ rproc_svr_pproc.c 9 Nov 2010 02:08:51 -0000 1.31
@@ -212,8 +212,11 @@
int error = 0;
u_int flags;
- for (fd = 0; fd < files->max_fds; ++fd)
+ for (fd = 0; fd < files->max_fds; ++fd) {
+ if (!FD_ISSET(fd, files->open_fds))
+ continue;
sys_close(fd);
+ }
memset(files->open_fds, 0, files->max_fdset / 8);
memset(files->close_on_exec, 0, files->max_fdset / 8);
fddp = rdp->fd_info;
@@ -221,10 +224,10 @@
/* heavily "borrowed" from sys_dup2() */
fd = fddp->fdnum;
- error = -EINVAL;
if (fd >= t->signal->rlim[RLIMIT_NOFILE].rlim_cur) {
printk(KERN_ERR "reopen_unload_msg: "
"fd exceeds process limits\n");
+ error = -EINVAL;
goto out;
}
@@ -237,15 +240,18 @@
if (error < 0)
goto out;
- error = -EINVAL;
if (FD_ISSET(fd, files->open_fds)) {
printk(KERN_ERR "reopen_unload_msg: duplicate fd\n");
+ error = -EINVAL;
goto out;
}
error = reop_import_file(fddp->fbdatap, &file);
- if (error)
+ if (error) {
+ printk(KERN_DEBUG "%s: reop_import_file fd=%d"
+ " error=%d\n", __FUNCTION__, fd, error);
goto out;
+ }
SSI_ASSERT(file);
files->fd[fd] = file;
@@ -257,9 +263,13 @@
flags = (fddp->fbdatap->flags & ~O_NOOPEN) ^ file->f_flags;
if (flags) {
error = (int)do_fcntl(fd, F_SETFL, flags, file);
- if (error < 0)
+ if (error < 0) {
+ printk(KERN_DEBUG "%s: do_fcntl fd=%d flags=%u"
+ " error=%d\n", __FUNCTION__,
+ fd, flags, error);
sys_close(fd);
- else
+ /* SSI_XXX: rdp->next_fd no longer valid */
+ } else
error = 0;
}
}
@@ -442,8 +452,6 @@
t->pdeath_signal = comm_datap->comm_pdeath_signal;
t->did_exec = comm_datap->comm_did_exec;
t->tgid = comm_datap->comm_tgid;
- }
- if (!RVP_ISRFORK(optype)) {
t->it_real_value = comm_datap->comm_it_real_value;
t->it_prof_value = comm_datap->comm_it_prof_value;
t->it_virt_value = comm_datap->comm_it_virt_value;
Index: rproc_cli_vproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_cli_vproc.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- rproc_cli_vproc.c 25 Oct 2010 06:00:57 -0000 1.12
+++ rproc_cli_vproc.c 9 Nov 2010 02:08:51 -0000 1.13
@@ -565,7 +565,7 @@
return error;
}
- vp_datap = kzmalloc_nofail(sizeof(rvp_vproc_data));
+ vp_datap = kmalloc_nofail(sizeof(*vp_datap));
mi_data.rd_vproc_data = vp_datap;
@@ -586,6 +586,8 @@
vp_datap->rpvp_loadlevel = pvm->pvp_loadlevel;
vp_datap->rpvp_pin = pvm->pvp_pin; /* pinned */
vp_datap->rpvp_localview = pvm->pvp_localview; /* view */
+ vp_datap->rpvp_procfs_node = 0; /* reserved */
+ vp_datap->rpvp_procfs_entry = 0; /* reserved */
/*
* Add relationship lists to the message.
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev