From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Aleksa Sarai <cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
Cc: lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
richard-/L3Ra7n9ekc@public.gmane.org,
fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v6 2/3] cgroups: allow a cgroup subsystem to reject a fork
Date: Mon, 16 Mar 2015 12:53:35 -0400 [thread overview]
Message-ID: <20150316165335.GC8353@htj.duckdns.org> (raw)
In-Reply-To: <1426307835-5893-3-git-send-email-cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
Hello, Aleksa.
On Sat, Mar 14, 2015 at 03:37:14PM +1100, Aleksa Sarai wrote:
> +/* Ditto for the can_fork/cancel_fork/reapply_fork callbacks. */
> +static int need_canfork_callback __read_mostly = 0,
> + need_reapplyfork_callback __read_mostly = 0;
Please separate the two definitions. Please consult
Documentation/CodingStyle and in general try not to be creative with
style.
> +int cgroup_can_fork(struct task_struct *child, void **state)
> +{
> + struct cgroup_subsys *ss;
> + struct css_set *cset;
> + int i, j, retval;
> +
> + cset = task_css_set(current);
> + get_css_set(cset);
So, you stuck with css_set refcnting. That's fine, but please do
finish discussing in the original thread instead of throwing out new
version without explaining why you reached a particular conclusion.
Did you explore the idea of passing an opaque pointer from can_fork to
post_fork? If so, why did you choose this direction instead of that
one?
Also, what pins the cset between task_css_set() and get_css_set()?
task_css_set() is protected by RCU and the above should have triggered
RCU warning if the debug option is enabled. Please always test with
the debug options enabled, especially the lockdep and RCU ones.
> + *state = cset;
There's no reason for css_set pointer to be passed around as an opaque
pointer. The type is fixed. I suppose this is from me mentioning
void pointer in the previous thread but that was about the cpuset
can_fork() implementation returning its css pointer, not css_set.
Please conclude discussions before working on the following version.
> @@ -5249,6 +5315,24 @@ void cgroup_post_fork(struct task_struct *child)
> }
>
> /*
> + * Deal with tasks that were migrated mid-fork. If the css_set
> + * changed between can_fork() and post_fork() an organisation
> + * operation has occurred, and we need to revert/reapply the
> + * the can_fork().
> + */
> + for_each_subsys_which(need_canfork_callback, ss, i) {
> + struct cgroup_subsys_state *css = cset->subsys[i],
> + *old_css = old_cset->subsys[i];
> +
> + /*
> + * We only reapply for subsystems whose
> + * association changed in the interim.
> + */
> + if (old_css != css && ss->reapply_fork)
> + ss->reapply_fork(css, old_css, child);
> + }
Do we really need a separate callback for this? Can't we just add
@old_css param to ss->fork() which is NULL if it didn't change since
can_fork()?
> @@ -1196,6 +1196,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
> {
> int retval;
> struct task_struct *p;
> + void *cfs;
If we're gonna do css_set, there's no need to make this an opaque
pointer.
Thanks.
--
tejun
next prev parent reply other threads:[~2015-03-16 16:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-14 4:37 [PATCH v6 0/3] cgroups: add pids subsystem Aleksa Sarai
2015-03-14 4:37 ` [PATCH v6 1/3] cgroups: use bitmask to filter for_each_subsys Aleksa Sarai
2015-03-16 16:42 ` Tejun Heo
2015-03-14 4:37 ` [PATCH v6 2/3] cgroups: allow a cgroup subsystem to reject a fork Aleksa Sarai
[not found] ` <1426307835-5893-3-git-send-email-cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
2015-03-16 16:53 ` Tejun Heo [this message]
[not found] ` <20150316165335.GC8353-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-03-21 11:25 ` Aleksa Sarai
[not found] ` <CAOviyagGvm4z8eAWitR267U3br-60vVJ9A5MMtFENy9xt9zuLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-26 15:08 ` Tejun Heo
2015-03-26 14:38 ` Aleksa Sarai
[not found] ` <CAOviyahTq1K6zBRfmXfepabiQ7xU8ZoNdq0jPd3nP4Q-0H1DDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-26 15:02 ` Tejun Heo
2015-03-26 21:41 ` Aleksa Sarai
[not found] ` <CAOviyah+5DFxYtUo1=LMdQLAte=YR1s4JYoH_DNZEfpoBUfSRw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-26 22:18 ` Tejun Heo
2015-03-14 4:37 ` [PATCH v6 3/3] cgroups: add a pids subsystem Aleksa Sarai
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=20150316165335.GC8353@htj.duckdns.org \
--to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org \
--cc=fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=richard-/L3Ra7n9ekc@public.gmane.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