From: "Paul Menage" <menage@google.com>
To: vatsa@in.ibm.com
Cc: sekharan@us.ibm.com, ckrm-tech@lists.sourceforge.net,
linux-kernel@vger.kernel.org, xemul@sw.ru, rohitseth@google.com,
pj@sgi.com, "Eric W. Biederman" <ebiederm@xmission.com>,
mbligh@google.com, winget@google.com, containers@lists.osdl.org,
"Serge E. Hallyn" <serue@us.ibm.com>,
dev@sw.ru, devel@openvz.org
Subject: Re: [ckrm-tech] [PATCH 7/7] containers (V7): Container interface to nsproxy subsystem
Date: Thu, 5 Apr 2007 02:29:32 -0700 [thread overview]
Message-ID: <6599ad830704050229q1d4d1ef9ved0e58b93aef31ff@mail.gmail.com> (raw)
In-Reply-To: <20070405084920.GB20356@in.ibm.com>
On 4/5/07, Srivatsa Vaddagiri <vatsa@in.ibm.com> wrote:
>
> You mean dentry->d_fsdata pointing to nsproxy should take a ref count on
> nsproxy? afaics it is not needed as long as you first drop the dentry
> before freeing associated nsproxy.
You get the nsproxy object from dup_namespaces(), which will give you
an nsproxy with a refcount of 1. So yes, your d_fsdata is already
holding a refcount.
>
> > - I think you probably need to subtract one for each active
> > subsystem.
>
> I don't understand this.
I meant for each active hierarchy, sorry. But thinking about this
further, I think you're right - since every container directory points
to an nsproxy that contains its own subsystems groups for subsystems
bound to that hierarchy, plus the root subsystem groups for subsystems
not bound to that hierarchy, no other container directory can have a
refcount on an nsproxy that matches this container directories bound
subsystem groups. So subtracting 1 as you do at the moment is fine. It
would be more of a problem if we were trying to rmdir the root
directories, but that's not an issue.
> I don't have a authoritative view here on whether open file count should
> be migrated or not, but from a layman perspective consider this:
>
> - Task T1 is in Container C1, whose max open files can be 100
> - T1 opens all of those 100 files
> - T1 migrates to Container C2, but its open file count is not
> migrated
> - T2 is migrated to container C1 and tries opening a file but is
> denied. T2 looks for "who is in my container who has opened all
> files" and doesn't find anyone.
>
> Isn't that a bit abnormal from an end-user pov?
Possibly. But isn't it equally abnormal if T1 opens a bunch of files,
forks, and its child is moved into a different container. Then C1 has
no open file count? I'm not sure that there's a universally right
answer to this, so we'd need to support both behaviours.
>
> > >Why refcount 3? I can only be 1 (from T) ..
> >
> > Plus the refcounts from the two filesystem roots.
>
> Filesystem root dentry's are special case. They will point to
> init_nsproxy which is never deleted and hence they need not add
> additional ref counts.
But you are taking an extra ref count - the call to
get_task_namespaces(&init_task).
> N1 won't be deleted w/o dropping
> foo's dentry first.
If the container directory were to have no refcount on the nsproxy, so
the initial refcount was 0, then surely moving a task in and out of
the container would push the refcount up to 1; moving it away would
cause the nsproxy to be freed when you call put_nsproxy(oldns) at the
end of attach_task(), since that would bring the refcount back down to
0. Similarly, the task exiting would have the same effect. But that's
not what's happening, since you are taking a ref count.
> I think this is very similar to cpuset case, where
> dentry->d_fsdata = cs doesnt take additional ref counts on cpuset.
That's different - the refcount on a cpuset falling to 0 doesn't free
the cpuset, it just makes it eligible to be freed by someone holding
the manage_mutex. the refcount on an nsproxy falling to 0 (via
put_nsproxy()) does cause the nsproxy to be freed).
> I agree we shouldn't delete a dir going by just the task count. How abt
> a (optional) ->can_destroy callback which will return -EBUSY if additional
> non-task objects are pointing to a subsyste's resource object?
Possibly - there are two choices:
1) expose a refcount to them directly, and just interrogate the
refcount from the generic code to see if it's safe to delete the
directory
2) have a can_destroy() callback with well defined semantics about
when it's safe to take refcounts again - it's quite possible that one
subsystem can return true from can_destroy() but others don't, in
which case the subsystem can become active again.
My patches solve this with an exposed refcount; to take a refcount on
a subsystem object that you don't already know to be still live, you
atomically bump the refcount if it's not -1; if it is -1 you wait for
it either to return to 0 or for the "dead" flag to be set by the
generic code. (This is all handled by inline functions so the
subsystem doesn't have to worry about the complexity).
If we were to say that if at any time the refcount and the task count
are both zero, then the refcount isn't allowed to increment until the
task count also increments, then it would probably be possible to
simplify these semantics to just check that all the refcounts were
zero. This probably isn't an unreasonable restriction to make. The
analog of this for option 2 would be to require that if ever the task
count is 0 and the resut of can_destroy() is true, the subsystem can't
get into a state where can_destroy() would return false without the
task count being incremented first (by a task moving into the
container).
Paul
next prev parent reply other threads:[~2007-04-05 9:29 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-12 8:15 [PATCH 0/7] containers (V7): Generic Process Containers menage
2007-02-12 8:15 ` [PATCH 1/7] containers (V7): Generic container system abstracted from cpusets code menage
2007-02-12 12:33 ` Srivatsa Vaddagiri
2007-02-12 19:26 ` Paul Menage
2007-02-12 19:46 ` Paul Menage
2007-02-13 5:48 ` Srivatsa Vaddagiri
2007-02-13 8:16 ` [ckrm-tech] " Srivatsa Vaddagiri
2007-03-07 12:21 ` Srivatsa Vaddagiri
2007-03-07 14:06 ` [ckrm-tech] " Srivatsa Vaddagiri
2007-03-07 20:50 ` Paul Menage
2007-03-08 10:38 ` [ckrm-tech] " Srivatsa Vaddagiri
2007-03-08 10:40 ` Paul Menage
2007-03-11 19:38 ` Paul Jackson
2007-03-12 14:19 ` Srivatsa Vaddagiri
2007-03-22 9:56 ` Srivatsa Vaddagiri
2007-03-22 10:20 ` Srivatsa Vaddagiri
2007-03-24 15:05 ` Srivatsa Vaddagiri
2007-03-24 19:25 ` Paul Jackson
2007-03-25 0:45 ` Srivatsa Vaddagiri
2007-03-25 1:41 ` Paul Jackson
2007-03-25 2:28 ` Srivatsa Vaddagiri
2007-03-25 4:16 ` Srivatsa Vaddagiri
2007-03-25 5:43 ` Paul Jackson
2007-03-25 8:21 ` Srivatsa Vaddagiri
2007-03-25 4:45 ` Paul Jackson
2007-03-25 5:05 ` Srivatsa Vaddagiri
2007-03-25 4:59 ` Paul Jackson
2007-02-12 8:15 ` [PATCH 2/7] containers (V7): Cpusets hooked into containers menage
2007-02-15 20:35 ` Serge E. Hallyn
2007-02-15 20:49 ` Paul Menage
2007-03-07 14:34 ` Srivatsa Vaddagiri
2007-03-07 16:01 ` Paul Menage
2007-03-07 16:31 ` [ckrm-tech] " Srivatsa Vaddagiri
2007-03-07 16:31 ` Paul Menage
2007-03-07 14:52 ` Srivatsa Vaddagiri
2007-03-07 16:12 ` Paul Menage
2007-02-12 8:15 ` [PATCH 4/7] containers (V7): Simple CPU accounting container subsystem menage
2007-02-12 8:15 ` [PATCH 5/7] containers (V7): Resource Groups over generic containers menage
2007-02-12 8:15 ` [PATCH 6/7] containers (V7): BeanCounters over generic process containers menage
2007-02-12 15:34 ` Srivatsa Vaddagiri
2007-02-12 18:49 ` Paul Menage
2007-02-13 8:52 ` Pavel Emelianov
2007-02-13 9:03 ` Paul Menage
2007-02-13 9:18 ` Pavel Emelianov
2007-02-13 9:37 ` Paul Menage
2007-02-13 9:49 ` Pavel Emelianov
2007-02-12 8:15 ` [PATCH 7/7] containers (V7): Container interface to nsproxy subsystem menage
2007-03-24 5:05 ` [ckrm-tech] " Srivatsa Vaddagiri
2007-03-24 16:23 ` Srivatsa Vaddagiri
2007-03-26 21:57 ` Serge E. Hallyn
2007-03-28 14:55 ` Srivatsa Vaddagiri
2007-03-28 15:26 ` Serge E. Hallyn
2007-03-26 21:55 ` Serge E. Hallyn
2007-03-31 2:47 ` Srivatsa Vaddagiri
2007-04-02 14:09 ` Serge E. Hallyn
2007-04-02 14:27 ` Srivatsa Vaddagiri
2007-04-02 18:02 ` Eric W. Biederman
2007-04-03 14:16 ` Srivatsa Vaddagiri
2007-04-03 15:32 ` Serge E. Hallyn
2007-04-03 15:45 ` Paul Menage
2007-04-03 15:54 ` Serge E. Hallyn
2007-04-03 16:16 ` Srivatsa Vaddagiri
2007-04-03 16:26 ` Kirill Korotaev
2007-04-03 16:46 ` Srivatsa Vaddagiri
2007-04-03 16:52 ` Paul Menage
2007-04-03 17:11 ` Srivatsa Vaddagiri
2007-04-03 17:10 ` Paul Menage
2007-04-03 17:30 ` Srivatsa Vaddagiri
2007-04-03 17:30 ` Paul Menage
2007-04-03 17:51 ` Srivatsa Vaddagiri
2007-04-03 17:49 ` Paul Menage
2007-04-04 3:07 ` Srivatsa Vaddagiri
2007-04-04 3:44 ` Paul Jackson
2007-04-04 4:04 ` Paul Menage
2007-04-04 5:15 ` Srivatsa Vaddagiri
2007-04-04 7:00 ` Paul Menage
2007-04-04 17:26 ` Srivatsa Vaddagiri
2007-04-04 17:42 ` Srivatsa Vaddagiri
2007-04-04 18:57 ` Paul Menage
2007-04-04 23:02 ` Eric W. Biederman
2007-04-05 1:35 ` Paul Menage
2007-04-05 1:37 ` Paul Menage
2007-04-05 16:57 ` Srivatsa Vaddagiri
2007-04-05 17:14 ` Srivatsa Vaddagiri
2007-04-06 21:54 ` Paul Menage
2007-04-05 2:57 ` Paul Menage
2007-04-05 6:39 ` Srivatsa Vaddagiri
2007-04-05 6:46 ` Srivatsa Vaddagiri
2007-04-05 6:48 ` Paul Menage
2007-04-05 8:49 ` Srivatsa Vaddagiri
2007-04-05 9:29 ` Paul Menage [this message]
2007-04-05 12:43 ` Srivatsa Vaddagiri
2007-04-05 14:13 ` Srivatsa Vaddagiri
2007-04-05 14:13 ` Paul Menage
2007-04-05 14:46 ` Srivatsa Vaddagiri
2007-04-03 17:34 ` Srivatsa Vaddagiri
2007-04-03 17:29 ` Paul Menage
2007-04-03 16:10 ` Srivatsa Vaddagiri
2007-04-03 15:41 ` Serge E. Hallyn
2007-02-12 9:18 ` [PATCH 0/7] containers (V7): Generic Process Containers Paul Jackson
2007-02-12 9:32 ` Paul Menage
2007-02-12 9:52 ` Paul Jackson
2007-02-12 22:38 ` Sam Vilain
2007-02-12 22:47 ` Serge E. Hallyn
2007-02-12 23:18 ` Paul Menage
2007-02-12 23:15 ` Paul Menage
2007-02-13 0:30 ` Sam Vilain
2007-02-13 0:42 ` [ckrm-tech] " Paul Menage
2007-02-13 1:13 ` Sam Vilain
2007-02-13 1:47 ` Paul Menage
2007-02-20 17:34 ` Eric W. Biederman
2007-02-20 17:55 ` Paul Menage
2007-02-20 19:29 ` Eric W. Biederman
2007-02-20 22:47 ` Paul Menage
2007-02-20 23:08 ` Sam Vilain
2007-02-20 23:36 ` Paul Menage
2007-02-20 23:32 ` Serge E. Hallyn
2007-02-20 21:58 ` Sam Vilain
2007-02-20 22:19 ` Paul Menage
2007-02-20 22:58 ` Sam Vilain
2007-02-20 23:28 ` Paul Menage
2007-02-20 23:37 ` Serge E. Hallyn
[not found] ` <20070212085104.485337000@menage.corp.google.com>
2007-02-12 15:27 ` [PATCH 3/7] containers (V7): Add generic multi-subsystem API to containers Srivatsa Vaddagiri
2007-02-12 18:40 ` Paul Menage
2007-02-13 13:19 ` Srivatsa Vaddagiri
2007-02-15 1:17 ` Paul Menage
2007-02-12 15:39 ` Serge E. Hallyn
2007-02-12 15:56 ` Cedric Le Goater
2007-02-12 18:31 ` Paul Menage
2007-02-14 8:49 ` Balbir Singh
2007-03-08 17:52 ` Srivatsa Vaddagiri
2007-03-24 12:51 ` [ckrm-tech] " Srivatsa Vaddagiri
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=6599ad830704050229q1d4d1ef9ved0e58b93aef31ff@mail.gmail.com \
--to=menage@google.com \
--cc=ckrm-tech@lists.sourceforge.net \
--cc=containers@lists.osdl.org \
--cc=dev@sw.ru \
--cc=devel@openvz.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@google.com \
--cc=pj@sgi.com \
--cc=rohitseth@google.com \
--cc=sekharan@us.ibm.com \
--cc=serue@us.ibm.com \
--cc=vatsa@in.ibm.com \
--cc=winget@google.com \
--cc=xemul@sw.ru \
/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
all inboxes | Powered by JetHome®