Re: [PATCH] Doc/cgroup: Use /sys/fs/cgroup as mountpoint for cgroupfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 26 May 2011 02:59:14 +0200 Jörg Sommer wrote:

> According to 676db4af043014e852f67ba0349dae0071bd11f3 the canonical
> mountpoint for the cgroup filesystem is /sys/fs/cgroup. Hence, this
> should be used in the documentation. Because /sys/fs/cgroup is created by
> cgroupfs, there's no need for userspace to create the directory. These
> commands were removed.

Hi,

Please copy CGROUP maintainers on such patches.
(now cc-ed)


> Signed-off-by: Jörg Sommer <joerg@xxxxxxxxxxxx>
> ---
>  Documentation/accounting/cgroupstats.txt |    4 +-
>  Documentation/cgroups/cgroups.txt        |   39 ++++++++++++++---------------
>  Documentation/cgroups/cpuacct.txt        |   21 +++++++--------
>  Documentation/cgroups/devices.txt        |    6 ++--
>  Documentation/cgroups/memory.txt         |   13 ++++-----
>  5 files changed, 40 insertions(+), 43 deletions(-)
> 
> diff --git a/Documentation/accounting/cgroupstats.txt b/Documentation/accounting/cgroupstats.txt
> index eda40fd..d16a984 100644
> --- a/Documentation/accounting/cgroupstats.txt
> +++ b/Documentation/accounting/cgroupstats.txt
> @@ -21,7 +21,7 @@ information will not be available.
>  To extract cgroup statistics a utility very similar to getdelays.c
>  has been developed, the sample output of the utility is shown below
>  
> -~/balbir/cgroupstats # ./getdelays  -C "/cgroup/a"
> +~/balbir/cgroupstats # ./getdelays  -C "/sys/fs/cgroup/a"
>  sleeping 1, blocked 0, running 1, stopped 0, uninterruptible 0
> -~/balbir/cgroupstats # ./getdelays  -C "/cgroup"
> +~/balbir/cgroupstats # ./getdelays  -C "/sys/fs/cgroup"
>  sleeping 155, blocked 0, running 1, stopped 0, uninterruptible 2
> diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
> index aedf1bd..5f8821f 100644
> --- a/Documentation/cgroups/cgroups.txt
> +++ b/Documentation/cgroups/cgroups.txt
> @@ -309,21 +309,20 @@ subsystem, this is the case for the cpuset.
>  To start a new job that is to be contained within a cgroup, using
>  the "cpuset" cgroup subsystem, the steps are something like:
>  
> - 1) mkdir /dev/cgroup
> - 2) mount -t cgroup -ocpuset cpuset /dev/cgroup
> - 3) Create the new cgroup by doing mkdir's and write's (or echo's) in
> -    the /dev/cgroup virtual file system.
> - 4) Start a task that will be the "founding father" of the new job.
> - 5) Attach that task to the new cgroup by writing its pid to the
> -    /dev/cgroup tasks file for that cgroup.
> - 6) fork, exec or clone the job tasks from this founding father task.
> + 1) mount -t cgroup -ocpuset cpuset /sys/fs/cgroup
> + 2) Create the new cgroup by doing mkdir's and write's (or echo's) in
> +    the /sys/fs/cgroup virtual file system.
> + 3) Start a task that will be the "founding father" of the new job.
> + 4) Attach that task to the new cgroup by writing its pid to the
> +    /sys/fs/cgroup tasks file for that cgroup.
> + 5) fork, exec or clone the job tasks from this founding father task.
>  
>  For example, the following sequence of commands will setup a cgroup
>  named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
>  and then start a subshell 'sh' in that cgroup:
>  
> -  mount -t cgroup cpuset -ocpuset /dev/cgroup
> -  cd /dev/cgroup
> +  mount -t cgroup cpuset -ocpuset /sys/fs/cgroup
> +  cd /sys/fs/cgroup
>    mkdir Charlie
>    cd Charlie
>    /bin/echo 2-3 > cpuset.cpus
> @@ -344,7 +343,7 @@ Creating, modifying, using the cgroups can be done through the cgroup
>  virtual filesystem.
>  
>  To mount a cgroup hierarchy with all available subsystems, type:
> -# mount -t cgroup xxx /dev/cgroup
> +# mount -t cgroup xxx /sys/fs/cgroup
>  
>  The "xxx" is not interpreted by the cgroup code, but will appear in
>  /proc/mounts so may be any useful identifying string that you like.
> @@ -355,21 +354,21 @@ for each new cgroup created before that group can be used.
>  
>  To mount a cgroup hierarchy with just the cpuset and memory
>  subsystems, type:
> -# mount -t cgroup -o cpuset,memory hier1 /dev/cgroup
> +# mount -t cgroup -o cpuset,memory hier1 /sys/fs/cgroup
>  
>  To change the set of subsystems bound to a mounted hierarchy, just
>  remount with different options:
> -# mount -o remount,cpuset,blkio hier1 /dev/cgroup
> +# mount -o remount,cpuset,blkio hier1 /sys/fs/cgroup
>  
>  Now memory is removed from the hierarchy and blkio is added.
>  
>  Note this will add blkio to the hierarchy but won't remove memory or
>  cpuset, because the new options are appended to the old ones:
> -# mount -o remount,blkio /dev/cgroup
> +# mount -o remount,blkio /sys/fs/cgroup
>  
>  To Specify a hierarchy's release_agent:
>  # mount -t cgroup -o cpuset,release_agent="/sbin/cpuset_release_agent" \
> -  xxx /dev/cgroup
> +  xxx /sys/fs/cgroup
>  
>  Note that specifying 'release_agent' more than once will return failure.
>  
> @@ -378,17 +377,17 @@ when the hierarchy consists of a single (root) cgroup. Supporting
>  the ability to arbitrarily bind/unbind subsystems from an existing
>  cgroup hierarchy is intended to be implemented in the future.
>  
> -Then under /dev/cgroup you can find a tree that corresponds to the
> -tree of the cgroups in the system. For instance, /dev/cgroup
> +Then under /sys/fs/cgroup you can find a tree that corresponds to the
> +tree of the cgroups in the system. For instance, /sys/fs/cgroup
>  is the cgroup that holds the whole system.
>  
>  If you want to change the value of release_agent:
> -# echo "/sbin/new_release_agent" > /dev/cgroup/release_agent
> +# echo "/sbin/new_release_agent" > /sys/fs/cgroup/release_agent
>  
>  It can also be changed via remount.
>  
> -If you want to create a new cgroup under /dev/cgroup:
> -# cd /dev/cgroup
> +If you want to create a new cgroup under /sys/fs/cgroup:
> +# cd /sys/fs/cgroup
>  # mkdir my_cgroup
>  
>  Now you want to do something with this cgroup.
> diff --git a/Documentation/cgroups/cpuacct.txt b/Documentation/cgroups/cpuacct.txt
> index 8b93094..9ad85df 100644
> --- a/Documentation/cgroups/cpuacct.txt
> +++ b/Documentation/cgroups/cpuacct.txt
> @@ -10,26 +10,25 @@ directly present in its group.
>  
>  Accounting groups can be created by first mounting the cgroup filesystem.
>  
> -# mkdir /cgroups
> -# mount -t cgroup -ocpuacct none /cgroups
> -
> -With the above step, the initial or the parent accounting group
> -becomes visible at /cgroups. At bootup, this group includes all the
> -tasks in the system. /cgroups/tasks lists the tasks in this cgroup.
> -/cgroups/cpuacct.usage gives the CPU time (in nanoseconds) obtained by
> -this group which is essentially the CPU time obtained by all the tasks
> +# mount -t cgroup -ocpuacct none /sys/fs/cgroup
> +
> +With the above step, the initial or the parent accounting group becomes
> +visible at /sys/fs/cgroup. At bootup, this group includes all the tasks in
> +the system. /sys/fs/cgroup/tasks lists the tasks in this cgroup.
> +/sys/fs/cgroup/cpuacct.usage gives the CPU time (in nanoseconds) obtained
> +by this group which is essentially the CPU time obtained by all the tasks
>  in the system.
>  
> -New accounting groups can be created under the parent group /cgroups.
> +New accounting groups can be created under the parent group /sys/fs/cgroup.
>  
> -# cd /cgroups
> +# cd /sys/fs/cgroup
>  # mkdir g1
>  # echo $$ > g1
>  
>  The above steps create a new group g1 and move the current shell
>  process (bash) into it. CPU time consumed by this bash and its children
>  can be obtained from g1/cpuacct.usage and the same is accumulated in
> -/cgroups/cpuacct.usage also.
> +/sys/fs/cgroup/cpuacct.usage also.
>  
>  cpuacct.stat file lists a few statistics which further divide the
>  CPU time obtained by the cgroup into user and system times. Currently
> diff --git a/Documentation/cgroups/devices.txt b/Documentation/cgroups/devices.txt
> index 57ca4c8..16624a7 100644
> --- a/Documentation/cgroups/devices.txt
> +++ b/Documentation/cgroups/devices.txt
> @@ -22,16 +22,16 @@ removed from the child(ren).
>  An entry is added using devices.allow, and removed using
>  devices.deny.  For instance
>  
> -	echo 'c 1:3 mr' > /cgroups/1/devices.allow
> +	echo 'c 1:3 mr' > /sys/fs/cgroup/1/devices.allow
>  
>  allows cgroup 1 to read and mknod the device usually known as
>  /dev/null.  Doing
>  
> -	echo a > /cgroups/1/devices.deny
> +	echo a > /sys/fs/cgroup/1/devices.deny
>  
>  will remove the default 'a *:* rwm' entry. Doing
>  
> -	echo a > /cgroups/1/devices.allow
> +	echo a > /sys/fs/cgroup/1/devices.allow
>  
>  will add the 'a *:* rwm' entry to the whitelist.
>  
> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
> index 7c16347..12401cd 100644
> --- a/Documentation/cgroups/memory.txt
> +++ b/Documentation/cgroups/memory.txt
> @@ -264,15 +264,14 @@ c. Enable CONFIG_CGROUP_MEM_RES_CTLR
>  d. Enable CONFIG_CGROUP_MEM_RES_CTLR_SWAP (to use swap extension)
>  
>  1. Prepare the cgroups
> -# mkdir -p /cgroups
> -# mount -t cgroup none /cgroups -o memory
> +# mount -t cgroup none /sys/fs/cgroup -o memory
>  
>  2. Make the new group and move bash into it
> -# mkdir /cgroups/0
> -# echo $$ > /cgroups/0/tasks
> +# mkdir /sys/fs/cgroup/0
> +# echo $$ > /sys/fs/cgroup/0/tasks
>  
>  Since now we're in the 0 cgroup, we can alter the memory limit:
> -# echo 4M > /cgroups/0/memory.limit_in_bytes
> +# echo 4M > /sys/fs/cgroup/0/memory.limit_in_bytes
>  
>  NOTE: We can use a suffix (k, K, m, M, g or G) to indicate values in kilo,
>  mega or gigabytes. (Here, Kilo, Mega, Giga are Kibibytes, Mebibytes, Gibibytes.)
> @@ -280,11 +279,11 @@ mega or gigabytes. (Here, Kilo, Mega, Giga are Kibibytes, Mebibytes, Gibibytes.)
>  NOTE: We can write "-1" to reset the *.limit_in_bytes(unlimited).
>  NOTE: We cannot set limits on the root cgroup any more.
>  
> -# cat /cgroups/0/memory.limit_in_bytes
> +# cat /sys/fs/cgroup/0/memory.limit_in_bytes
>  4194304
>  
>  We can check the usage:
> -# cat /cgroups/0/memory.usage_in_bytes
> +# cat /sys/fs/cgroup/0/memory.usage_in_bytes
>  1216512
>  
>  A successful write to this file does not guarantee a successful set of
> -- 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux