OpenVZ Forum - RDF feed
type: channel
items: [PATCH 2/6] Rename pid_nr function
items: Re: [PATCH 2/6] Rename pid_nr function

[PATCH 2/6] Rename pid_nr function
type: item
description: Subject: [PATCH 2/6] Rename pid_nr function From: Sukadev Bhattiprolu <sukadev@us.ibm.com> Rename pid_nr() function to pid_to_nr() which is more descriptive and will hopefully cause less confusion with new structure/functions being added to support multiple pid namespaces. Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> --- drivers/char/n_r3964.c | 7 ++++--- drivers/char/tty_io.c | 4 ++-- fs/autofs/root.c | 2 +- fs/fcntl.c | 2 +- fs/proc/array.c | 2 +- fs/smbfs/proc.c | 2 +- include/linux/pid.h | 2 +- ipc/mqueue.c | 2 +- kernel/container.c | 2 +- kernel/fork.c | 2 +- kernel/sysctl.c | 2 +- 11 files changed, 15 insertions(+), 14 deletions(-) Index: lx26-22-rc6-mm1/include/linux/pid.h =================================================================== --- lx26-22-rc6-mm1.orig/include/linux/pid.h 2007-07-05 18:53:43.000000000 -0700 +++ lx26-22-rc6-mm1/include/linux/pid.h 2007-07-05 18:54:29.000000000 -0700 @@ -98,7 +98,7 @@ extern struct pid *find_ge_pid(int nr); extern struct pid *alloc_pid(void); extern void FASTCALL(free_pid(struct pid *pid)); -static inline pid_t pid_nr(struct pid *pid) +static inline pid_t pid_to_nr(struct pid *pid) { pid_t nr = 0; if (pid) Index: lx26-22-rc6-mm1/drivers/char/n_r3964.c =================================================================== --- lx26-22-rc6-mm1.orig/drivers/char/n_r3964.c 2007-07-05 18:53:43.000000000 -0700 +++ lx26-22-rc6-mm1/drivers/char/n_r3964.c 2007-07-05 18:54:29.000000000 -0700 @@ -771,7 +771,7 @@ static int enable_signals(struct r3964_i if (pClient->pid == pid) { TRACE_PS("removing client %d from client list", - pid_nr(pid)); + pid_to_nr(pid)); *ppClient = pClient->next; while (pClient->msg_count) { pMsg = remove_msg(pInfo, pClient); @@ -801,7 +801,8 @@ static int enable_signals(struct r3964_i if (pClient == NULL) return -ENOMEM; - TRACE_PS("add client %d to client list", pid_nr(pid)); + TRACE_PS("add client %d to client list", + pid_to_nr(pid)); spin_lock_init(&pClient->lock); pClient->sig_flags = arg; …
creator: Sukadev Bhattiprolu
date: 2007-07-06T05:53:16-00:00

Re: [PATCH 2/6] Rename pid_nr function
type: item
description: sukadev@us.ibm.com wrote: > Subject: [PATCH 2/6] Rename pid_nr function > > From: Sukadev Bhattiprolu <sukadev@us.ibm.com> > > Rename pid_nr() function to pid_to_nr() which is more descriptive > and will hopefully cause less confusion with new structure/functions > being added to support multiple pid namespaces. Don't we need at least two convertors: pid_to_nr_as_it_seen_by_current() and pid_to_nr_as_it_seen_by_some_other_task() The first one is essentially the second one with "some other task" being current, but it can be optimized... > Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> > --- > drivers/char/n_r3964.c | 7 ++++--- > drivers/char/tty_io.c | 4 ++-- > fs/autofs/root.c | 2 +- > fs/fcntl.c | 2 +- > fs/proc/array.c | 2 +- > fs/smbfs/proc.c | 2 +- > include/linux/pid.h | 2 +- > ipc/mqueue.c | 2 +- > kernel/container.c | 2 +- > kernel/fork.c | 2 +- > kernel/sysctl.c | 2 +- > 11 files changed, 15 insertions(+), 14 deletions(-) > > Index: lx26-22-rc6-mm1/include/linux/pid.h > =================================================================== > --- lx26-22-rc6-mm1.orig/include/linux/pid.h 2007-07-05 18:53:43.000000000 -0700 > +++ lx26-22-rc6-mm1/include/linux/pid.h 2007-07-05 18:54:29.000000000 -0700 > @@ -98,7 +98,7 @@ extern struct pid *find_ge_pid(int nr); > extern struct pid *alloc_pid(void); > extern void FASTCALL(free_pid(struct pid *pid)); > > -static inline pid_t pid_nr(struct pid *pid) > +static inline pid_t pid_to_nr(struct pid *pid) > { > pid_t nr = 0; > if (pid) > Index: lx26-22-rc6-mm1/drivers/char/n_r3964.c > =================================================================== > --- lx26-22-rc6-mm1.orig/drivers/char/n_r3964.c 2007-07-05 18:53:43.000000000 -0700 > +++ lx26-22-rc6-mm1/drivers/char/n_r3964.c 2007-07-05 18:54:29.000000000 -0700 > @@ -771,7 +771,7 @@ static int enable_signals(struct r3964_i > > if (pClient->pid == pid) { > TRACE_PS("removing client %d from client list", > - pid_nr(pid)); > + pid_to_nr(pid)); > *ppClient = pClient-…
creator: Pavel Emelianov
date: 2007-07-13T05:26:18-00:00

Re: [PATCH 2/6] Rename pid_nr function
type: item
description: Pavel Emelianov [xemul@openvz.org] wrote: | sukadev@us.ibm.com wrote: | > Subject: [PATCH 2/6] Rename pid_nr function | > | > From: Sukadev Bhattiprolu <sukadev@us.ibm.com> | > | > Rename pid_nr() function to pid_to_nr() which is more descriptive | > and will hopefully cause less confusion with new structure/functions | > being added to support multiple pid namespaces. | | Don't we need at least two convertors: | pid_to_nr_as_it_seen_by_current() | and | pid_to_nr_as_it_seen_by_some_other_task() Can you give me an example of where you would use this latter (pid_to_nr_as_it_seen_by_some_other_task()) interface ? I have a similar confusion with following two sets of interfaces in your patchset and have been meaning to discuss it further. pid_nr() and pid_vnr() find_pid() and find_vpid() I can understand the use of pid_vnr() and find_vpid(). Where do you see us using pid_nr() and find_pid() - i.e the values as seen in init_pid_ns ? Like I pointed out in another thread, sunos_killpg() for instance needs to used find_vpid(). Similarly, kill_proc_info(), __set_special_pids() etc need find_vpid(). Thanks, Suka | | The first one is essentially the second one with "some other | task" being current, but it can be optimized... | | > Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> | > --- | > drivers/char/n_r3964.c | 7 ++++--- | > drivers/char/tty_io.c | 4 ++-- | > fs/autofs/root.c | 2 +- | > fs/fcntl.c | 2 +- | > fs/proc/array.c | 2 +- | > fs/smbfs/proc.c | 2 +- | > include/linux/pid.h | 2 +- | > ipc/mqueue.c | 2 +- | > kernel/container.c | 2 +- | > kernel/fork.c | 2 +- | > kernel/sysctl.c | 2 +- | > 11 files changed, 15 insertions(+), 14 deletions(-) | > | > Index: lx26-22-rc6-mm1/include/linux/pid.h | > =================================================================== | > --- lx26-22-rc6-mm1.orig/include/linux/pid.h 2007-07-05 18:53:43.000000000 -0700 | > +++ lx26-22-rc6-mm1/include/linux/pid.h 2007-07-05 18:54:29.000000000 -0700 | > @@ -98,7 +98,7 @@ extern struct…
creator: Sukadev Bhattiprolu
date: 2007-07-13T05:55:43-00:00

Re: [PATCH 2/6] Rename pid_nr function
type: item
description: sukadev@us.ibm.com wrote: > Pavel Emelianov [xemul@openvz.org] wrote: > | sukadev@us.ibm.com wrote: > | > Subject: [PATCH 2/6] Rename pid_nr function > | > > | > From: Sukadev Bhattiprolu <sukadev@us.ibm.com> > | > > | > Rename pid_nr() function to pid_to_nr() which is more descriptive > | > and will hopefully cause less confusion with new structure/functions > | > being added to support multiple pid namespaces. > | > | Don't we need at least two convertors: > | pid_to_nr_as_it_seen_by_current() > | and > | pid_to_nr_as_it_seen_by_some_other_task() > > Can you give me an example of where you would use this latter > (pid_to_nr_as_it_seen_by_some_other_task()) interface ? Easy. Consider you're observing /proc/<pid>/status file for a task that lives in two namespaces - init and some created. When making "cat" on this from init namespace you must get the task's pid as it is seen from init namespace, but when making "cat" from the created namespace you must see the pid as it is seen by this namespace. And so on and so forth. On the other hand sys_getpid() should simply return the virtual pid without messing with namespaces. > I have a similar confusion with following two sets of interfaces > in your patchset and have been meaning to discuss it further. > > pid_nr() and pid_vnr() > find_pid() and find_vpid() > > I can understand the use of pid_vnr() and find_vpid(). > > Where do you see us using pid_nr() and find_pid() - i.e the values > as seen in init_pid_ns ? find_pid() may be used in keventd_create_thread() as eventd thread lives in init namespace only. Any other place in kernel that is somehow "global" to all the namespaces and has no user interface must use global pids not to confuse the kernel. Of course, if we plan to replace the notion of global numerical pid with struct pid this is not an option. However, the issues with the pid_to_nr_as_it_... are still valid. > Like I pointed out in another thread, sunos_killpg() for instance > needs to used find_vpid(). Simil…
creator: Pavel Emelianov
date: 2007-07-13T06:23:06-00:00

Re: [PATCH 2/6] Rename pid_nr function
type: item
description: Quoting Pavel Emelianov (xemul@openvz.org): > sukadev@us.ibm.com wrote: > > Pavel Emelianov [xemul@openvz.org] wrote: > > | sukadev@us.ibm.com wrote: > > | > Subject: [PATCH 2/6] Rename pid_nr function > > | > > > | > From: Sukadev Bhattiprolu <sukadev@us.ibm.com> > > | > > > | > Rename pid_nr() function to pid_to_nr() which is more descriptive > > | > and will hopefully cause less confusion with new structure/functions > > | > being added to support multiple pid namespaces. > > | > > | Don't we need at least two convertors: > > | pid_to_nr_as_it_seen_by_current() > > | and > > | pid_to_nr_as_it_seen_by_some_other_task() > > > > Can you give me an example of where you would use this latter > > (pid_to_nr_as_it_seen_by_some_other_task()) interface ? > > Easy. Consider you're observing /proc/<pid>/status file for a task > that lives in two namespaces - init and some created. When making > "cat" on this from init namespace you must get the task's pid as it > is seen from init namespace, but when making "cat" from the created > namespace you must see the pid as it is seen by this namespace. And > so on and so forth. But 'current' in that case is the process reading the file, so you do in fact want to use pid_to_nr_as_it_seen_by_current(). -serge > On the other hand sys_getpid() should simply return the virtual pid > without messing with namespaces. > > > I have a similar confusion with following two sets of interfaces > > in your patchset and have been meaning to discuss it further. > > > > pid_nr() and pid_vnr() > > find_pid() and find_vpid() > > > > I can understand the use of pid_vnr() and find_vpid(). > > > > Where do you see us using pid_nr() and find_pid() - i.e the values > > as seen in init_pid_ns ? > > find_pid() may be used in keventd_create_thread() as eventd thread > lives in init namespace only. Any other place in kernel that is > somehow "global" to all the namespaces and has no user interface > must use global pids not to confuse the kernel. > > Of course…
creator: serue
date: 2007-07-13T13:43:43-00:00

Re: [PATCH 2/6] Rename pid_nr function
type: item
description: Serge E. Hallyn wrote: > Quoting Pavel Emelianov (xemul@openvz.org): >> sukadev@us.ibm.com wrote: >>> Pavel Emelianov [xemul@openvz.org] wrote: >>> | sukadev@us.ibm.com wrote: >>> | > Subject: [PATCH 2/6] Rename pid_nr function >>> | > >>> | > From: Sukadev Bhattiprolu <sukadev@us.ibm.com> >>> | > >>> | > Rename pid_nr() function to pid_to_nr() which is more descriptive >>> | > and will hopefully cause less confusion with new structure/functions >>> | > being added to support multiple pid namespaces. >>> | >>> | Don't we need at least two convertors: >>> | pid_to_nr_as_it_seen_by_current() >>> | and >>> | pid_to_nr_as_it_seen_by_some_other_task() >>> >>> Can you give me an example of where you would use this latter >>> (pid_to_nr_as_it_seen_by_some_other_task()) interface ? >> Easy. Consider you're observing /proc/<pid>/status file for a task >> that lives in two namespaces - init and some created. When making >> "cat" on this from init namespace you must get the task's pid as it >> is seen from init namespace, but when making "cat" from the created >> namespace you must see the pid as it is seen by this namespace. And >> so on and so forth. > > But 'current' in that case is the process reading the file, so you do in > fact want to use pid_to_nr_as_it_seen_by_current(). Well. I see. There's a misleading in names. Better would be called them pid_nr_as_it_is_seen_by_the_owning_task_when_he_reads_it() %) and pid_nr_as_it_is_seen_by_arbitrary_task() the first one is pid_vnr() the second is pid_nr_ns(). > -serge _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Pavel Emelianov
date: 2007-07-13T14:09:31-00:00

Re: [PATCH 2/6] Rename pid_nr function
type: item
description: Pavel Emelianov [xemul@openvz.org] wrote: | Serge E. Hallyn wrote: | > Quoting Pavel Emelianov (xemul@openvz.org): | >> sukadev@us.ibm.com wrote: | >>> Pavel Emelianov [xemul@openvz.org] wrote: | >>> | sukadev@us.ibm.com wrote: | >>> | > Subject: [PATCH 2/6] Rename pid_nr function | >>> | > | >>> | > From: Sukadev Bhattiprolu <sukadev@us.ibm.com> | >>> | > | >>> | > Rename pid_nr() function to pid_to_nr() which is more descriptive | >>> | > and will hopefully cause less confusion with new structure/functions | >>> | > being added to support multiple pid namespaces. | >>> | | >>> | Don't we need at least two convertors: | >>> | pid_to_nr_as_it_seen_by_current() | >>> | and | >>> | pid_to_nr_as_it_seen_by_some_other_task() | >>> | >>> Can you give me an example of where you would use this latter | >>> (pid_to_nr_as_it_seen_by_some_other_task()) interface ? | >> Easy. Consider you're observing /proc/<pid>/status file for a task | >> that lives in two namespaces - init and some created. When making | >> "cat" on this from init namespace you must get the task's pid as it | >> is seen from init namespace, but when making "cat" from the created | >> namespace you must see the pid as it is seen by this namespace. And | >> so on and so forth. My patches use pid_nr_in_ns(pid, ns) in that case - where we get 'ns' from the specific mount of /proc accesed. So the init_pid_ns process would execute in init_pid_ns and the other would be in child ns. So, in your case wouldn't it be enough to have pid_vnr() and pid_nr_in_ns() ? | > | > But 'current' in that case is the process reading the file, so you do in | > fact want to use pid_to_nr_as_it_seen_by_current(). | | Well. I see. There's a misleading in names. Better would be called them | pid_nr_as_it_is_seen_by_the_owning_task_when_he_reads_it() %) | and | pid_nr_as_it_is_seen_by_arbitrary_task() | | the first one is pid_vnr() the second is pid_nr_ns(). yep. | | > -serge _______________________________________________ Containers mai…
creator: Sukadev Bhattiprolu
date: 2007-07-13T16:11:09-00:00