[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4C6A3812.1070002@cn.fujitsu.com>
Date: Tue, 17 Aug 2010 15:19:46 +0800
From: Li Zefan <lizf@...fujitsu.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
CC: Paul Menage <menage@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ben Blum <bblum@...gle.com>,
containers@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org,
Alex Williamson <alex.williamson@...hat.com>,
kvm@...r.kernel.org
Subject: Re: [PATCH] cgroups: fix API thinko
(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@...hat.com>
Acked-by: Li Zefan <lizf@...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);
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists