Product SiteDocumentation Site

2.7. Setting Parameters

Set subsystem parameters by running the cgset command from a user account with permission to modify the relevant cgroup. For example, if /cgroup/cpuset/group1 exists, specify the CPUs to which this group has access with the following command:
cpuset]# cgset -r cpuset.cpus=0-1 group1
The syntax for cgset is:
cgset -r parameter=value path_to_cgroup
The values that you can set with cgset might depend on values set higher in a particular hierarchy. For example, if group1 is limited to use only CPU 0 on a system, you cannot set group1/subgroup1 to use CPUs 0 and 1, or to use only CPU 1.
You can also use cgset to copy the parameters of one cgroup into another, existing cgroup. For example:
~]# cgset --copy-from group1/ group2/
The syntax to copy parameters with cgset is:
cgset --copy-from path_to_source_cgroup path_to_target_cgroup
Ensure that any mandatory parameters for the various subsystems are set before you copy parameters from one group to another, or the command will fail. For more information on mandatory parameters, refer to Mandatory parameters.

Alternative method

To set parameters in a cgroup directly, insert values into the relevant subsystem pseudo-file using the echo command. For example, this command inserts the value 0-1 into the cpuset.cpus pseudo-file of the cgroup group1:
~]# echo 0-1 > /cgroup/cpuset/group1/cpuset.cpus
With this value in place, the tasks in this cgroup are restricted to CPUs 0 and 1 on the system.