2009-06-16 11:15:26

by Nikanth Karthikesan

[permalink] [raw]
Subject: cpusets: document adding/removing cpus to cpuset elaborately

Writing a pid to the file, tasks adds that task to that cgroup/cpuset. But to
add a cpu/mem to a cpuset, the new list of cpus should be written to the
cpuset.mems file which would replace the old list of cpus. Make this clearer
in the documentation.

Signed-off-by: Nikanth Karthikesan <[email protected]>

---

diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroups/cpusets.txt
index f9ca389..1d7e978 100644
--- a/Documentation/cgroups/cpusets.txt
+++ b/Documentation/cgroups/cpusets.txt
@@ -777,6 +777,18 @@ in cpuset directories:
# /bin/echo 1-4 > cpus -> set cpus list to cpus 1,2,3,4
# /bin/echo 1,2,3,4 > cpus -> set cpus list to cpus 1,2,3,4

+To add a CPU to a cpuset, write the new list of CPUs including the
+CPU to be added. To add 6 to the above cpuset:
+
+# /bin/echo 1-4,6 > cpus -> set cpus list to cpus 1,2,3,4,6
+
+Similarly to remove a CPU from a cpuset, write the new list of CPUs
+without the CPU to be removed.
+
+To remove all the CPUs:
+
+# /bin/echo "" > cpus -> clear cpus list
+
2.3 Setting flags
-----------------




2009-06-17 00:44:14

by Li Zefan

[permalink] [raw]
Subject: Re: cpusets: document adding/removing cpus to cpuset elaborately

Nikanth Karthikesan wrote:
> Writing a pid to the file, tasks adds that task to that cgroup/cpuset. But to
> add a cpu/mem to a cpuset, the new list of cpus should be written to the
> cpuset.mems file which would replace the old list of cpus. Make this clearer
> in the documentation.
>

Though I think '>' already means overwrite so removing/adding cpus should
always writing the full list of CPUs to 'cpus', more documentation to make
cpuset usage clearer is not bad.

Acked-by: Li Zefan <[email protected]>

> Signed-off-by: Nikanth Karthikesan <[email protected]>
>
> ---
>
> diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroups/cpusets.txt
> index f9ca389..1d7e978 100644
> --- a/Documentation/cgroups/cpusets.txt
> +++ b/Documentation/cgroups/cpusets.txt
> @@ -777,6 +777,18 @@ in cpuset directories:
> # /bin/echo 1-4 > cpus -> set cpus list to cpus 1,2,3,4
> # /bin/echo 1,2,3,4 > cpus -> set cpus list to cpus 1,2,3,4
>
> +To add a CPU to a cpuset, write the new list of CPUs including the
> +CPU to be added. To add 6 to the above cpuset:
> +
> +# /bin/echo 1-4,6 > cpus -> set cpus list to cpus 1,2,3,4,6
> +
> +Similarly to remove a CPU from a cpuset, write the new list of CPUs
> +without the CPU to be removed.
> +
> +To remove all the CPUs:
> +
> +# /bin/echo "" > cpus -> clear cpus list
> +
> 2.3 Setting flags
> -----------------
>

2009-06-17 09:43:15

by Paul Menage

[permalink] [raw]
Subject: Re: cpusets: document adding/removing cpus to cpuset elaborately

On Tue, Jun 16, 2009 at 5:45 PM, Li Zefan<[email protected]> wrote:
> Nikanth Karthikesan wrote:
>> Writing a pid to the file, tasks adds that task to that cgroup/cpuset. But to
>> add a cpu/mem to a cpuset, the new list of cpus should be written to the
>> cpuset.mems file which would replace the old list of cpus. Make this clearer
>> in the documentation.
>>
>
> Though I think '>' already means overwrite so removing/adding cpus should
> always writing the full list of CPUs to 'cpus'

But in the context of cgroups/cpusets that's not always the case -
think of the "tasks" file.

>
> Acked-by: Li Zefan <[email protected]>

Acked-by: Paul Menage <[email protected]>

Paul