RE: [PATCH v7 1/2] procfs: show hierarchy of pid namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Richard Weinberger [mailto:richard@xxxxxx]
> Sent: Wednesday, November 12, 2014 7:15 PM
> To: Chen, Hanxiao/陈 晗霄; Eric W. Biederman; Serge Hallyn; Oleg Nesterov
> Cc: containers@xxxxxxxxxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; David
> Howells; Richard Weinberger; Pavel Emelyanov; Vasiliy Kulikov; Mateusz Guzik
> Subject: Re: [PATCH v7 1/2] procfs: show hierarchy of pid namespace
> 
> Am 12.11.2014 um 11:08 schrieb Chen Hanxiao:
> > We lack of pid hierarchy information, and this will lead to:
> > a) we don't know pids' relationship, who is whose child:
> >    /proc/PID/ns/pid only tell us whether two pids live in different ns
> > b) bring trouble to nested lxc container check/restore/migration
> > c) bring trouble to pid translation between containers;
> >
> > This patch will show the hierarchy of pid namespace
> > by pidns_hierarchy like:
> >
> > <init_PID> <parent_of_init_PID> <relative PID level>
> >
> > Ex:
> > [root@localhost ~]#cat /proc/pidns_hierarchy
> > 18060 1 1
> > 18102 18060 2
> > 1534  18102 3
> > 1600  18102 3
> > 1550  1 1
> > *Note: numbers represent the pid 1 in different ns
> >
[snip]
> > +
> > +#define NS_HIERARCHY	"pidns_hierarchy"
> > +#define MAX(a, b) ((a) > (b) ? (a) : (b))
> 
> Please use max() from kernel.h, there is no need to reinvent the wheel.
> 

Thanks for your reminding.

> > +
> > +/* list for host pid collection */
> > +struct pidns_list {
> > +	struct list_head list;
> > +	struct pid *pid;
> > +	int show_level;
> 
> s/show_level/level, to keep it easy. :-)

Sure, also change the type to unsigned int 
for making max() happy.

[snip]
> > +}
> > +
> > +/*
> > + * collect pids and stored in pidns_pid_list,
> 
> s/stored/store
Oops...

> 
> > + * then remove duplicated ones,
> > + * add the rest to pidns_pid_tree
> > + */
> 
> This comment is a bit confusing.
> 
> What about "proc_pidns_list_refresh - Finds all init pids, places them into
> pidns_pid_list
> and then stores the hirarchy into pidns_pid_tree."?
> 
That's much more clear.

> Beside of my minor comments I like the patch. :-)
> Thanks a lot for doing this work!
> 

Thanks for your kindly help. :)

- Chen
_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/containers





[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux