On Sat, Jul 1, 2017 at 10:50 PM, Leon Yang <leon.gh.y...@gmail.com> wrote: > Hi, > > I am measuring the time cost of parallel creation and destruction of > net namespaces. > > As cleanup_net() is invoked from workqueue, the exit of a net > namespace does not mean the cleanup is completed. Therefore I use > ftrace to count the number of net_drop_ns() are called. But I found > that the number of namespaces created does not match with the number > of net_drop_ns() calls even after a long wait. > > Can you give some hints on why this is happening? and what would be > the correct way to know when the last cleanup_net() is done?
Probably no way to know this in user-space, netns is refcount'ed, we don't know which is the last one releasing it. There is a per-userns counter for netns, but I don't see it is ever exposed to user-space.