[SSI] openssi/kernel/cluster/ssi/vproc rproc_cli_pproc.c, 1.25, 1.26 rproc_svr_pproc.c, 1.29, 1.30
Roger Tsang <[email protected]> Mon, 25 Oct 2010 06:08:02 +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-serv14856/cluster/ssi/vproc
Modified Files:
Tag: OPENSSI-FC
rproc_cli_pproc.c rproc_svr_pproc.c
Log Message:
VPROC (#ifdef VPROC_UNLOAD_SETSCHED_SMP)
- Revise use of tasklist_lock in common_data_load_msg() / common_data_unload_msg()
VPROC (#ifdef PPROC_SETCTTY_SIGLOCK)
- In signal_unload_msg() fix BKL extra unlock when RVP_ISRFORK() is true.
- Fix import_dirs() might sleep in atomic.
- import_dirs() function should not always inline.
- Optimize away multiple current() calls in reopen_unload_msg(), set_global_root(), import_dirs(), export_dirs().
cluster/ssi/vproc/rproc_cli_pproc.c | 40 +++++---------
cluster/ssi/vproc/rproc_svr_pproc.c | 78 +++++++++++++++-------------
2 files changed, 57 insertions(+), 61 deletions(-)
Index: rproc_cli_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_cli_pproc.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- rproc_cli_pproc.c 17 Dec 2009 06:43:51 -0000 1.25
+++ rproc_cli_pproc.c 25 Oct 2010 06:08:00 -0000 1.26
@@ -53,8 +53,7 @@
static int
group_info_load_msg(rvp_group_info_t *rgp)
{
- struct task_struct *t = current;
- struct group_info *gp = t->group_info;
+ struct group_info *gp = current->group_info;
/* SSI_XXX: fix to handle more than NGROUPS_SMALL groups. */
if (gp->ngroups > NGROUPS_SMALL)
@@ -476,6 +475,7 @@
static inline int
export_dirs(rvp_common_data *comm_datap, int optype)
{
+ task_t *t = current;
struct dentry *root, *pwd, *altroot;
struct vfsmount *rootmnt, *pwdmnt, *altrootmnt;
int error;
@@ -484,16 +484,16 @@
comm_datap->comm_p_adir = NULL;
comm_datap->comm_p_cdir = NULL;
- read_lock(¤t->fs->lock);
+ read_lock(&t->fs->lock);
- comm_datap->comm_umask = current->fs->umask;
- root = dget(current->fs->root);
- pwd = dget(current->fs->pwd);
- altroot = dget(current->fs->altroot);
- rootmnt = mntget(current->fs->rootmnt);
- pwdmnt = mntget(current->fs->pwdmnt);
- altrootmnt = mntget(current->fs->altrootmnt);
- read_unlock(¤t->fs->lock);
+ comm_datap->comm_umask = t->fs->umask;
+ root = dget(t->fs->root);
+ pwd = dget(t->fs->pwd);
+ altroot = dget(t->fs->altroot);
+ rootmnt = mntget(t->fs->rootmnt);
+ pwdmnt = mntget(t->fs->pwdmnt);
+ altrootmnt = mntget(t->fs->altrootmnt);
+ read_unlock(&t->fs->lock);
error = reop_export_path(root, rootmnt, optype,
#ifdef REOP_EXPORT_PATH_SVRNODE
@@ -544,21 +544,14 @@
*comm_datapp = comm_datap;
-#ifndef VPROC_UNLOAD_SETSCHED_SMP
/*
* It is assumed that no locks need be held to read information
* from the task structure.
*/
-#else
- read_lock_irq(&tasklist_lock);
-#endif
error = thread_info_load_msg(&comm_datap->comm_thread_info, optype);
- if (error < 0) {
-#ifdef VPROC_UNLOAD_SETSCHED_SMP
- read_unlock_irq(&tasklist_lock);
-#endif
+ if (error < 0)
goto out;
- }
+
comm_datap->comm_flags = t->flags;
comm_datap->comm_ptrace = t->ptrace;
@@ -572,9 +565,7 @@
comm_datap->comm_exit_code = t->exit_code;
comm_datap->comm_exit_signal = t->exit_signal;
-#ifdef VPROC_UNLOAD_SETSCHED_SMP
- read_unlock_irq(&tasklist_lock);
-#endif
+
comm_datap->comm_pdeath_signal = t->pdeath_signal;
comm_datap->comm_personality = t->personality;
comm_datap->comm_did_exec = t->did_exec;
@@ -722,7 +713,6 @@
struct arch_regs_stack *regs,
int optype)
{
- struct task_struct *t = current;
rvp_full_data *full_datap;
int error;
@@ -736,7 +726,7 @@
*full_datapp = full_datap;
full_datap->full_regs = *regs;
- full_datap->full_binfmt_name = t->binfmt->name;
+ full_datap->full_binfmt_name = current->binfmt->name;
error = rproc_arch_data_load_msg(full_datap, stack_start,
stack_size, optype);
if (error < 0)
Index: rproc_svr_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_svr_pproc.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- rproc_svr_pproc.c 2 Feb 2010 04:21:59 -0000 1.29
+++ rproc_svr_pproc.c 25 Oct 2010 06:08:00 -0000 1.30
@@ -138,7 +138,8 @@
t->signal->flags = rsigp->rvp_ss_flags;
t->signal->tty_old_pgrp = rsigp->rvp_ss_tty_old_pgrp;
#ifdef PPROC_SETCTTY_SIGLOCK
- unlock_kernel();
+ if (locked)
+ unlock_kernel();
#endif
t->signal->leader = rsigp->rvp_ss_leader;
t->signal->cttydev = rsigp->rvp_ss_cttydev;
@@ -203,8 +204,9 @@
reopendata *rdp,
int optype)
{
+ task_t *t = current;
fd_data *fddp;
- struct files_struct *files = current->files;
+ struct files_struct *files = t->files;
struct file *file;
unsigned int fd, idx;
int error = 0;
@@ -220,7 +222,7 @@
fd = fddp->fdnum;
error = -EINVAL;
- if (fd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) {
+ if (fd >= t->signal->rlim[RLIMIT_NOFILE].rlim_cur) {
printk(KERN_ERR "reopen_unload_msg: "
"fd exceeds process limits\n");
goto out;
@@ -270,13 +272,14 @@
static void
set_global_root(void)
{
+ task_t *t = current;
struct dentry *root, *old;
struct vfsmount *rootmnt, *oldmnt, *lastrootmnt;
- read_lock(¤t->fs->lock);
- old = dget(current->fs->root);
- oldmnt = mntget(current->fs->rootmnt);
- read_unlock(¤t->fs->lock);
+ read_lock(&t->fs->lock);
+ old = dget(t->fs->root);
+ oldmnt = mntget(t->fs->rootmnt);
+ read_unlock(&t->fs->lock);
/* Find top-of-tree; don't use "rootfs" filesystem. */
/* spin_lock(&dcache_lock); */
@@ -295,7 +298,7 @@
/* spin_unlock(&dcache_lock); */
if (lastrootmnt != oldmnt) {
- set_fs_root(current->fs, rootmnt, root);
+ set_fs_root(t->fs, rootmnt, root);
dput(root);
mntput(rootmnt);
}
@@ -312,11 +315,14 @@
* can start from the global root, rather than the process root
* we now install.
*/
-static inline int
+static int
import_dirs(rvp_common_data *comm_datap)
{
+ task_t *t = current;
struct dentry *root = NULL, *pwd = NULL, *altroot = NULL;
+ struct dentry *old_root, *old_pwd, *old_altroot = NULL;
struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL;
+ struct vfsmount *old_rootmnt, *old_pwdmnt, *old_altrootmnt = NULL;
int error;
error = reop_import_path(comm_datap->comm_p_cdir,
@@ -336,32 +342,40 @@
if (!pwd || !root)
goto rap_fail;
- write_lock(¤t->fs->lock);
+ write_lock(&t->fs->lock);
- current->fs->umask = comm_datap->comm_umask;
+ t->fs->umask = comm_datap->comm_umask;
- dput(current->fs->root);
- current->fs->root = root;
+ old_root= t->fs->root;
+ t->fs->root = root;
- dput(current->fs->pwd);
- current->fs->pwd = pwd;
+ old_pwd = t->fs->pwd;
+ t->fs->pwd = pwd;
if (altroot) {
- dput(current->fs->altroot);
- current->fs->altroot = altroot;
+ old_altroot = t->fs->altroot;
+ t->fs->altroot = altroot;
}
- mntput(current->fs->rootmnt);
- current->fs->rootmnt = rootmnt;
+ old_rootmnt = t->fs->rootmnt;
+ t->fs->rootmnt = rootmnt;
- mntput(current->fs->pwdmnt);
- current->fs->pwdmnt = pwdmnt;
+ old_pwdmnt = t->fs->pwdmnt;
+ t->fs->pwdmnt = pwdmnt;
if (altroot) {
- mntput(current->fs->altrootmnt);
- current->fs->altrootmnt = altrootmnt;
+ old_altrootmnt = t->fs->altrootmnt;
+ t->fs->altrootmnt = altrootmnt;
}
- write_unlock(¤t->fs->lock);
+ write_unlock(&t->fs->lock);
+
+ dput(old_root);
+ dput(old_pwd);
+ if (altroot)
+ dput(old_altroot);
+ mntput(old_rootmnt);
+ mntput(old_pwdmnt);
+ mntput(old_altrootmnt);
return 0;
@@ -388,17 +402,9 @@
unsigned long flags;
int error, oldprio = 0;
-#ifdef VPROC_UNLOAD_SETSCHED_SMP
- /* set_daemon_prio(0, SCHED_NORMAL); */
- write_lock_irq(&tasklist_lock);
-#endif
error = thread_info_unload_msg(&comm_datap->comm_thread_info, optype);
- if (error < 0) {
-#ifdef VPROC_UNLOAD_SETSCHED_SMP
- write_unlock_irq(&tasklist_lock);
-#endif
+ if (error < 0)
goto out;
- }
t->flags = comm_datap->comm_flags;
if (RVP_ISRFORK(optype))
@@ -427,7 +433,6 @@
t->exit_code = comm_datap->comm_exit_code;
t->exit_signal = comm_datap->comm_exit_signal;
#ifdef VPROC_UNLOAD_SETSCHED_SMP
- write_unlock_irq(&tasklist_lock);
set_binfmt(NULL); /* See as_unxscribe(). */
#endif
set_personality(comm_datap->comm_personality);
@@ -481,6 +486,8 @@
t->cap_inheritable = comm_datap->comm_cap_inheritable;
t->cap_permitted = comm_datap->comm_cap_permitted;
t->keep_capabilities = comm_datap->comm_keep_capabilities;
+
+ /* switch_uid() */
atomic_dec(&t->user->processes);
free_uid(t->user);
t->user = alloc_uid(t->uid);
@@ -553,11 +560,10 @@
struct arch_regs_stack *regs,
int optype)
{
- struct task_struct *t = current;
int error;
set_binfmt_by_name(full_datap->full_binfmt_name);
- if (t->binfmt == NULL)
+ if (current->binfmt == NULL)
return -ENOEXEC;
if (optype != RVP_MIGRATE_THREAD) {
/* Do VM. */
------------------------------------------------------------------------------
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