On Wed, Dec 10, 2008 at 10:15 PM, Dhaval Giani
<[EMAIL PROTECTED]> wrote:
>
> On Tue, Dec 09, 2008 at 11:58:14PM +0530, Balbir Singh wrote:
> > * Dhaval Giani <[EMAIL PROTECTED]> [2008-12-09 23:53:14]:
> >
> > > On Tue, Dec 09, 2008 at 11:35:46PM +0530, Balbir Singh wrote:
> > > > Hi, All,
> > > >
> > > > I've been experimenting with task migration in cgroups and hit a
> > > > strange problem
> > > >
> > > > 1. By default all classes belong to the root group
> > > > 2. When I migrate a group to a different group (I can migrate based on
> > > >    permissions)
> > > > 3. But when I am done, I can't migrate back to the root group since
> > > >    all of it is owned by root
> > > >
> > > > I am playing around with a fix that allows creation of a /default
> > > > group and using cgrulesengd, we can classify all tasks to /default. I
> > > > propose giving world read, write permissions to /default/tasks, so
> > > > that a class can return back home when it is done with its work in
> > > > other groups. I faced this issue when I created a thread pool and used
> > > > different threads to move to various groups, but in the end they had
> > > > no place to return back to :(
> > > >
> > > > Here is a proposed fix. Thoughts? Comments? Flames?
> > > >
> > >
> > > Yeah, but you are not checking out the cgrules.conf file to find the
> > > default group. So I propose the following,
> > >
> > > 1. First read the cgrules.conf file and find the default group (it can
> > > be specified by putting * in the uesr field)
> > > 2. If that is not specified, create a sysdefault cgroup which is world
> > > writable and move all tasks there.
> >
> > Sounds reasonable
> >
> > "... Show me the code" :)
> >
>
> OK, what about,
>
> ---
> libcgroup: Allow tasks to be moved back to a default cgroup
>
> From: Balbir Singh <[EMAIL PROTECTED]>
>
> I've been experimenting with task migration in cgroups and hit a
> strange problem
>
> 1. By default all classes belong to the root group
> 2. When I migrate a group to a different group (I can migrate based on
>   permissions)
> 3. But when I am done, I can't migrate back to the root group since
>   all of it is owned by root
>
> I am playing around with a fix that allows creation of a /default
> group and using cgrulesengd, we can classify all tasks to /default. I
> propose giving world read, write permissions to /default/tasks, so
> that a class can return back home when it is done with its work in
> other groups. I faced this issue when I created a thread pool and used
> different threads to move to various groups, but in the end they had
> no place to return back to :(
>
> Here is a proposed fix. Thoughts? Comments? Flames?
>
> Signed-off-by: Balbir Singh <[EMAIL PROTECTED]>
> Signed-off-by: Dhaval Giani <[EMAIL PROTECTED]>
>
> ---
>  scripts/init.d/cgconfig |   20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> Index: trunk/scripts/init.d/cgconfig
> ===================================================================
> --- trunk.orig/scripts/init.d/cgconfig  2008-10-30 21:52:23.000000000 +0530
> +++ trunk/scripts/init.d/cgconfig       2008-12-10 22:13:54.000000000 +0530
> @@ -81,6 +81,26 @@ start() {
>         then
>                 #log_progress_msg "Starting cgconfig service: "
>                 cgconfigparser -l $CONFIG_FILE
> +               #
> +               # Create a default class for tasks to return back to
> +               #
> +               parse_mounts
> +               if [ -f /etc/cgrules.conf]
> +               then
> +                       defaultcgroup=`grep ^* /etc/cgrules.conf | awk '{ 
> printf "%s", $3 }'`

I don't like the awk dependency and assumption.

> +               fi
> +               if [ -z $defaultcgroup]
> +                       defaultcgroup=sysdefault/
> +               fi
> +               for i in `seq 1 $maxindex`
> +               do
> +                       #
> +                       # Ignore if directory already exists
> +                       #
> +                       mkdir ${MOUNTPOINT[$i]}/$defaultcgroup 2> /dev/null
> +                       chmod a+rw ${MOUNTPOINT[$i]}/$defaultcgroup/tasks
> +               done
> +
>         fi
>         [ $? == 0 ] && touch /var/lock/subsys/$servicename
>         return $?
>
> --
> regards,
> Dhaval
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Libcg-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libcg-devel

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to