From: Li Zefan <lizf@cn.fujitsu.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paul Menage <menage@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Ben Blum <bblum@google.com>,
containers@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
Alex Williamson <alex.williamson@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH] cgroups: fix API thinko
Date: Tue, 17 Aug 2010 15:19:46 +0800 [thread overview]
Message-ID: <4C6A3812.1070002@cn.fujitsu.com> (raw)
In-Reply-To: <20100805225914.GA26772@redhat.com>
(Just came back from vacation)
Michael S. Tsirkin wrote:
> cgroup_attach_task_current_cg API that have upstream is backwards: we
> really need an API to attach to the cgroups from another process A to
> the current one.
>
> In our case (vhost), a priveledged user wants to attach it's task to cgroups
> from a less priveledged one, the API makes us run it in the other
> task's context, and this fails.
>
> So let's make the API generic and just pass in 'from' and 'to' tasks.
> Add an inline wrapper for cgroup_attach_task_current_cg to avoid
> breaking bisect.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Li Zefan <lizf@cn.fujitsu.com>
I also don't like the name, but I'm not good at English or naming. ;)
> ---
>
> Paul, Li, Sridhar, could you please review the following
> patch?
>
> I only compile-tested it due to travel, but looks
> straight-forward to me.
> Alex Williamson volunteered to test and report the results.
> Sending out now for review as I might be offline for a bit.
> Will only try to merge when done, obviously.
>
> If OK, I would like to merge this through -net tree,
> together with the patch fixing vhost-net.
> Let me know if that sounds ok.
>
That's Ok.
...
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 43b2072..b38ec60 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -525,7 +525,11 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
> void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
> int cgroup_scan_tasks(struct cgroup_scanner *scan);
> int cgroup_attach_task(struct cgroup *, struct task_struct *);
> -int cgroup_attach_task_current_cg(struct task_struct *);
> +int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
a nitpick:
better add a blank line here.
> +static inline int cgroup_attach_task_current_cg(struct task_struct *tsk)
> +{
> + return cgroup_attach_task_all(current, tsk);
> +}
next prev parent reply other threads:[~2010-08-17 7:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 22:59 [PATCH] cgroups: fix API thinko Michael S. Tsirkin
2010-08-06 15:09 ` Alex Williamson
2010-08-06 16:34 ` Sridhar Samudrala
[not found] ` <4C5C3985.5060706-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-08-06 16:38 ` Alex Williamson
2010-08-06 16:38 ` Alex Williamson
2010-08-25 21:35 ` Andrew Morton
2010-08-26 2:08 ` Paul Menage
2010-08-31 14:57 ` Michael S. Tsirkin
[not found] ` <20100825143520.9954d3f9.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2010-08-26 2:08 ` Paul Menage
2010-08-31 14:57 ` Michael S. Tsirkin
2010-08-25 21:35 ` Andrew Morton
[not found] ` <20100805225914.GA26772-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-08-06 15:09 ` Alex Williamson
2010-08-06 16:34 ` Sridhar Samudrala
2010-08-17 7:19 ` Li Zefan
2010-08-17 7:19 ` Li Zefan [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-08-05 22:59 Michael S. Tsirkin
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=4C6A3812.1070002@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=bblum@google.com \
--cc=containers@lists.linux-foundation.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=mst@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.