lkml.org 
[lkml]   [2014]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRE: [PATCH v9 1/3] procfs: show hierarchy of pid namespace
    Date


    > -----Original Message-----
    > From: containers-bounces@lists.linux-foundation.org
    > [mailto:containers-bounces@lists.linux-foundation.org] On Behalf Of Chen
    > Hanxiao
    > Sent: Monday, December 01, 2014 7:06 PM
    > To: Eric W. Biederman; Serge Hallyn; Oleg Nesterov; Richard Weinberger; Andrew
    > Morton
    > Cc: containers@lists.linux-foundation.org; linux-kernel@vger.kernel.org;
    > Mateusz Guzik; David Howells
    > Subject: [PATCH v9 1/3] procfs: show hierarchy of pid namespace
    >
    > 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
    >
    > It shows the pid hierarchy below:
    >
    > init_pid_ns 1
    > │
    > ┌────────────┐
    > ns1 ns2
    > │ │
    > 1550 18060
    > │
    > │
    > ns3
    > │
    > 18102
    > │
    > ┌──────────┐
    > ns4 ns5
    > │ │
    > 1534 1600
    >
    > Every pid printed in pidns_hierarchy
    > is the init pid of that pid ns level.
    >
    > Acked-by: Richard Weinberer <richard@nod.at>
    >
    > Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
    > ---
    > v9: fix codes be included if CONFIG_PID_NS=n
    > v8: use max() from kernel.h
    > fix some improper comments
    > v7: change stype to be consistent with current interface like
    > <init_PID> <parent_of_init_PID> <relative PID level>
    > remove EXPERT dependent in Kconfig
    > v6: fix a get_pid leak and do some cleanups;
    > v5: collect pid by find_ge_pid;
    > use local list inside nslist_proc_show;
    > use get_pid, remove mutex lock.
    > v4: simplify pid collection and some performance optimizamtion
    > fix another race issue.
    > v3: fix a race issue and memory leak issue
    > v2: use a procfs text file instead of dirs under /proc
    >

    Hi,

    Any comments?

    Thanks,
    - Chen
    \
     
     \ /
      Last update: 2014-12-04 14:01    [W:4.017 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site