Re: [Patch] /proc interface
Moshe Bar <moshe-ay74M1d3r6RWk0Htik3J/[email protected]>
| Newsgroups | gmane.linux.cluster.openmosix.devel |
|---|---|
| Message-ID | <[email protected]> |
Another excellent patch. Tested it and works out of the box.
Kris, this should get into the standard tree. Tab, please work it
into your 2.6 patches, as well.
Ansgar, you are welcome to supply your own 2.6 vanilla kernel OM
patches which we will roll into test rpms before release OM. David
Orcero is currently working on the user land tools and load balancer
for 2.6.
Many thanks!!
Moshe
On Mar 24, 2006, at 11:58 AM, Ansgar Esztermann wrote:
> Here are some improvements to /proc/{pid}/om/where:
>
> -Upon read, return the socket's peer address, not its own. In the
> current version, a migrated process would report the IP address of
> its
> home node.
>
> -When asking an already migrated process to move to another (remote)
> node, bring it back home first. The current implementation leads to a
> crash. A direct remote->remote migration would be better, but is not
> implemented yet.
> This change entails reordering two functions in hpc/migctrl.c, so the
> changes look worse than they really are.
>
> -When trying to migrate a task back home, check whether it really is
> migrated to a remote node. Failing to do so will lead to a crash.
>
> Have a nice weekend,
>
> A.
>
>
>
> diff -ruNp linux-2.6-om/hpc/comm.c linux-2.6-om-work/hpc/comm.c
> --- linux-2.6-om/hpc/comm.c 2006-02-07 16:51:58.000000000 +0100
> +++ linux-2.6-om-work/hpc/comm.c 2006-03-24 18:36:26.000000000 +0100
> @@ -54,10 +54,11 @@ static void comm_shutdown(om_link_t *mli
>
> /**
> * comm_getname - get the name of socket
> - * @mlink: openMosix link to shutdown
> + * @mlink: openMosix link to query
> * @address: the sockaddr to fill
> + * @peer: get peer name instead?
> **/
> -int comm_getname(om_link_t *mlink, struct sockaddr *address)
> +int comm_getname(om_link_t *mlink, struct sockaddr *address, int
> peer)
> {
> struct socket *sock;
> int val, ret;
> @@ -66,7 +67,7 @@ int comm_getname(om_link_t *mlink, struc
> sock = mlink->sock;
> if (!sock->ops || !sock->ops->getname)
> return -1;
> - ret = sock->ops->getname(sock, address, &val, 0);
> + ret = sock->ops->getname(sock, address, &val, peer);
> if (ret)
> return -1;
> return val;
> diff -ruNp linux-2.6-om/hpc/migctrl.c linux-2.6-om-work/hpc/migctrl.c
> --- linux-2.6-om/hpc/migctrl.c 2006-02-07 16:51:58.000000000 +0100
> +++ linux-2.6-om-work/hpc/migctrl.c 2006-03-24 18:36:26.000000000
> +0100
> @@ -79,6 +79,44 @@ int task_remote_wait_expel(task_t *p)
> return task_remote_expel(p);
> }
>
> +
> +/**
> + * task_local_bring - Receive task back in the deputy stub
> + * @p: deputy task to receive
> + * @reason: reason to send (if any)
> + **/
> +static int task_local_bring(task_t *p, int reason)
> +{
> + int error;
> + om_link_t *link;
> +
> + if (obtain_mm(p)) {
> + printk(KERN_ERR "unable to obtain mm\n");
> + goto failed;
> + }
> +
> + /* send remote request */
> + comm_send_req(p->om.contact, DEP_COMING_HOME);
> +
> + /* see if other part is with on this */
> + if (mig_recv_hshake(p->om.contact))
> + goto failed;
> +
> + /* receive the process back */
> + error = mig_do_receive(p);
> + if (error)
> + goto failed;
> +
> + task_clear_dflags(p, DDEPUTY);
> + link = task_set_comm(p, NULL);
> + comm_close(link);
> +
> + return 0;
> +failed:
> + OMBUG("failed\n");
> + return -1;
> +}
> +
> /**
> * task_local_send - Send a local task to remote
> * @p: task to send
> @@ -90,6 +128,14 @@ static int task_local_send(task_t *p, st
> om_link_t *mlink;
> int error = 0;
>
> + /* if this is a stub, bring it back first */
> + if (p->om.contact)
> + {
> + error = task_local_bring(p, reason);
> + if (error)
> + goto failed;
> + }
> +
> sockaddr_setup_port(whereto, REMOTE_DAEMON_PORT);
> mlink = comm_setup_connect(whereto, 0);
> if (!mlink) {
> @@ -123,44 +169,6 @@ failed:
> }
>
>
> -
> -/**
> - * task_local_bring - Receive task back in the deputy stub
> - * @p: deputy task to receive
> - * @reason: reason to send (if any)
> - **/
> -static int task_local_bring(task_t *p, int reason)
> -{
> - int error;
> - om_link_t *link;
> -
> - if (obtain_mm(p)) {
> - printk(KERN_ERR "unable to obtain mm\n");
> - goto failed;
> - }
> -
> - /* send remote request */
> - comm_send_req(p->om.contact, DEP_COMING_HOME);
> -
> - /* see if other part is with on this */
> - if (mig_recv_hshake(p->om.contact))
> - goto failed;
> -
> - /* receive the process back */
> - error = mig_do_receive(p);
> - if (error)
> - goto failed;
> -
> - task_clear_dflags(p, DDEPUTY);
> - link = task_set_comm(p, NULL);
> - comm_close(link);
> -
> - return 0;
> -failed:
> - OMBUG("failed\n");
> - return -1;
> -}
> -
> /**
> * task_move_remote2remote - migrate a task from remote to remote
> * @p: task to send
> diff -ruNp linux-2.6-om/hpc/proc.c linux-2.6-om-work/hpc/proc.c
> --- linux-2.6-om/hpc/proc.c 2006-02-07 16:51:58.000000000 +0100
> +++ linux-2.6-om-work/hpc/proc.c 2006-03-24 18:36:26.000000000 +0100
> @@ -57,7 +57,7 @@ static int proc_pid_get_where(struct tas
> struct sockaddr address;
>
> if (p->om.contact) {
> - comm_getname(p->om.contact, &address);
> + comm_getname(p->om.contact, &address, 1);
> length = sockaddr_to_string(&address, buf);
> length += sprintf(buf + length, "\n");
> } else
> diff -ruNp linux-2.6-om/hpc/remote.c linux-2.6-om-work/hpc/remote.c
> --- linux-2.6-om/hpc/remote.c 2006-02-07 16:51:58.000000000 +0100
> +++ linux-2.6-om-work/hpc/remote.c 2006-03-24 18:36:26.000000000 +0100
> @@ -264,7 +264,7 @@ long remote_do_fork(unsigned long clone_
> if (!childsock)
> goto fail;
>
> - if (comm_getname(childsock, &sa) < 0)
> + if (comm_getname(childsock, &sa, 0) < 0)
> goto fail;
>
> memcpy(&m.sockaddr, &sa, sizeof(struct sockaddr));
> diff -ruNp linux-2.6-om/hpc/service.c linux-2.6-om-work/hpc/service.c
> --- linux-2.6-om/hpc/service.c 2006-02-07 16:51:58.000000000 +0100
> +++ linux-2.6-om-work/hpc/service.c 2006-03-24 18:36:26.000000000
> +0100
> @@ -131,7 +131,7 @@ int sockaddr_inherit(om_link_t *mlink, s
> {
> struct sockaddr tmp;
>
> - if (comm_getname(mlink, &tmp) < 0)
> + if (comm_getname(mlink, &tmp, 0) < 0)
> return -1;
>
> memset(sa, 0, sizeof(struct sockaddr));
> diff -ruNp linux-2.6-om/hpc/task.c linux-2.6-om-work/hpc/task.c
> --- linux-2.6-om/hpc/task.c 2006-02-07 16:51:58.000000000 +0100
> +++ linux-2.6-om-work/hpc/task.c 2006-03-24 18:36:26.000000000 +0100
> @@ -130,7 +130,10 @@ void task_request_move(task_t *p)
> addr = p->om.whereto;
> p->om.whereto = NULL;
>
> - task_move_to_node(p, addr, 0);
> + if (addr)
> + task_move_to_node(p, addr, 0);
> + else
> + task_go_home(p);
> kfree(addr);
> }
>
> --
> Ansgar Esztermann
> Researcher & Sysadmin
> http://www2.thphy.uni-duesseldorf.de/~ansgar
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642