From: Chengdong Li <chengdong.li@linux.alibaba.com>
To: Andi Kleen <ak@linux.intel.com>
Cc: ebiederm@xmission.com, peterz@infradead.org,
kjlx@templeofstupid.com, hbathini@linux.vnet.ibm.com,
brendan.d.gregg@gmail.com, linux-kernel@vger.kernel.org,
chengdong.licd@alibaba-inc.com
Subject: Re: Question: How to switch a process namespace by nsfs "device" and inode number directly?
Date: Wed, 12 Sep 2018 10:05:27 +0800 [thread overview]
Message-ID: <52b34c00-fb4d-7490-5a40-0b7328895ad1@linux.alibaba.com> (raw)
In-Reply-To: <20180910160201.GV27886@tassilo.jf.intel.com>
Thank you, Andi!
Yes, that's a situation, also it's an important one I guess.
Another case is that a process running inside a container has exited but
the container still alive.I think this is also a common case. The
potential fix solutions I am thinking are following:
- Using nsfs "device" and inum. This is why I am asking for your help.
As we already have nsfs "device" and inum of each thread at least.
- If the current thread has exited, it's probably the parent thread and
the leader thread of that container are still alive. If we could have
those threads' pid, then we could use setns.
If the first item is not doable, I would like to try the second one.
Thanks,
Chengdong
在 2018/9/11 上午12:02, Andi Kleen 写道:
> On Mon, Sep 10, 2018 at 04:50:42PM +0800, Chengdong Li wrote:
>> Hi folks,
>>
>> I am getting stuck by the lack of approach to switch process namespace by
>> nsfs "device" and inode number in user-space, for example (mnt: 0xf0000000)
>>
>> From my best understanding, the normal way to do that is by setns system
>> call. But setns only accept fd that refer to a opened namespace, sometimes
>> we couldn't get it.
>>
>> For example: After perf record, perf report couldn't work well once the
>> process that runs inside a container has exited, as the /proc/pid/ns doesn't
>> exist anymore after process exit.
> The kernel name space doesn't exist anymore at this point, so there is simply no way
> to reconstruct it.
>
> Perhaps would need some higher level side band data for perf, similar as what
> is done for JITed code. Somehow the container run time needs to tell perf
> where to find the code.
>
> -Andi
next prev parent reply other threads:[~2018-09-12 2:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 8:50 Chengdong Li
2018-09-10 16:02 ` Andi Kleen
2018-09-12 2:05 ` Chengdong Li [this message]
2018-09-12 16:51 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52b34c00-fb4d-7490-5a40-0b7328895ad1@linux.alibaba.com \
--to=chengdong.li@linux.alibaba.com \
--cc=ak@linux.intel.com \
--cc=brendan.d.gregg@gmail.com \
--cc=chengdong.licd@alibaba-inc.com \
--cc=ebiederm@xmission.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=kjlx@templeofstupid.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome