public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kazunaga Ikeno <k-ikeno@ak.jp.nec.com>
To: containers@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [RFC][PATCH 0/1]a new optional function for task assignment to cgroup
Date: Wed, 05 Mar 2008 14:39:54 +0900	[thread overview]
Message-ID: <47CE322A.9060907@ak.jp.nec.com> (raw)

Hi -

This is a patch of a new optional function for task assignment to cgroup, RFC.


== Purpose =================================================

To provide the function that leads a task, corresponding to the conditions specified
beforehand, to a specific cgroup directory.


== Description =============================================

This patch provides the function that leads a task, corresponding to the conditions
specified beforehand, to a specific cgroup directory.

Currently, this patch uses user-id as a condition to lead a task. On its I/F,
specifies user-id of a task and a cgroup directory.

The task set to specified user-id will automatically lead to the cgroup directory.
(it is attached to specific cgroup)

This function makes possible to attach a task to cgroup automatically when
specific user logs in, also to attach a task of a service which is set to
specific effective user-id to specific cgroup mechanically.

This function is just option, all the functions of cgroup are the same.
Also the migration of a task between cgroup directories can do by rewriting pid
of a control tasks file, including a task leading by this option.

It is able to enter two or more set of user-id and cgroup directory.
Specified cgroup directory may be the same or that may not be.
But it's not able to enter same user-id to plural cgroup directories to lead.


== Interface ===============================================

   /lead_option  -  control file of this option

[example for reading a configuration]

       # cat /cgroup/lead_option

       uid:202        leadto:/cpuset/bar_cg
       uid:201        leadto:/cpuset/foo_cg

      * nothing appears before assignment.

[example for adding an entry]
- To lead a task(uid 201) to /cgroup/foo_cg

       # echo uid:201 leadto:/cpuset/foo_cg > /cpuset/lead_option

       * set a uid of task and cgroup dirctory to lead.
       * Remake an entry uid to cgroup directory if set uid already exists.

[example for delete an entry]
- To delete an entry of uid

       # echo uid:201 > /cpuset/lead_option

       * To delete a registration, omit "leadto:" token.


== Operation example (chronological order) ==================

The follows is an example of the operation.

# ############################
# # Various confirmation before testing
# ############################
# id
uid=0(root) gid=0(root) groups=0(root)
# df /cpuset
Filesystem           1K-blocks      Used Available Use% Mounted on
none                         0         0         0   -  /cpuset
# more /proc/self/cgroup
cpuset:/
# id foo
uid=201(foo) gid=100(users) groups=100(users)
# id bar
uid=202(foo) gid=100(users) groups=100(users)
# ############################
# # Add an entry of user foo,bar
# ############################
# echo uid:201 leadto:/cpuset/foo_cg > /cpuset/lead_option
# echo uid:202 leadto:/cpuset/bar_cg > /cpuset/lead_option
# more /cpuset/lead_option
uid:202        leadto:/cpuset/bar_cg
uid:201        leadto:/cpuset/foo_cg
# ############################
# # Confirmation of the assignment of user foo,bar - (1)
# ############################
# su - foo
$ more /proc/$$/cgroup
cpuset:/foo_cg
$ more /proc/self/cgroup
cpuset:/foo_cg
$ su bar --command "more /proc/self/cgroup"
cpuset:/bar_cg
$ exit
# ############################
# # Delete an entry of user foo,bar
# ############################
# echo uid:201 > /cpuset/lead_option
# echo uid:202 > /cpuset/lead_option
# more /cpuset/lead_option
# ############################
# # Confirmation of the assignment of user foo,bar - (2)
# ############################
# su - foo
$ more /proc/$$/cgroup
cpuset:/
$ su bar --command "more /proc/self/cgroup"
cpuset:/
$


Thanks,
- Kazunaga Ikeno.




             reply	other threads:[~2008-03-05  5:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05  5:39 Kazunaga Ikeno [this message]
2008-03-05  5:56 ` [RFC][PATCH 0/1]a new optional function for task assignment to cgroup Paul Menage
2008-03-05  7:02   ` Kazunaga Ikeno
2008-03-05  7:05     ` Paul Menage
2008-03-05  7:13   ` Dhaval Giani

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=47CE322A.9060907@ak.jp.nec.com \
    --to=k-ikeno@ak.jp.nec.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.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