My Favorites

Close

Please to see your favorites.

  • Bookmark
  • Email Document
  • Printer Friendly
  • Favorite
  • Rating:

Isolating CPUs From The General Scheduler

This document (7009596) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11 Service Pack 1

Situation

Dedicating a CPU to a specific performance-critical process/task is desired.

Resolution

Defining isolated CPUs

The isolcpus boot parameter can be used to specify CPUs to be isolated from the general SMP balancing
and scheduler algorithms.

Isolating a CPU prevents tasks/processes from being assigned to or from the CPU by the scheduler and therefore
assigning processes/tasks to or from the CPU must be done manually via the taskset, cset commands, or other
software utilizing the CPU affinity syscalls.

Automated load balancing of a process/task across multiple isolated CPUs is not possible.

The syntax is of the isolcpus boot parameter is:

isolcpus=<cpu number>,....,<cpu number>

where <cpu number> begins at 0 and the maximum number is ("number of CPUs in system" - 1)

For example, if the system has 4 CPUs, and the last two CPUs are to be isolated:

isolcpus=2,3

Once the system is booted with this parameter, processes/tasks will not be assigned to or from
the specified CPU(s) until processes are assigned via the taskset or cset commands.

On Linux, the taskset command can be used to set the CPU affinity of processes, and the cset
command allows you to group CPUs and memory into logical entities and restrict processes to the
resources of one or more of those logical entities.

To implement this boot parameter, use YaST->System->Boot Loader to add it to the "Optional
Kernel Command Line Parameters" field of the desired boot menu selection.

Managing Processes/Tasks On Isolated CPUs

Since by definition isolated CPUs are removed from the SMP balancing and scheduling algorithms,
assigning processes/tasks assigned to or from them must be done manually.

This is accomplished with either the taskset or cset commands to set CPU affinity for the process/task.
Once set, that process/task will not be moved away from the configured CPU unless done so manually.

Using Taskset To Assign A Process To an Isolated CPU

By default, the CPU affinity of a process is all non-isolated CPUs.

Assuming the boot parameter in the example above was used, the CPU affinity
of all processes is going to be CPU 0-1.

To check the CPU affinity of a process with taskset, use the command

# taskset -c -p <pid>

where <pid> is the PID of the process to check.

To change the CPU affinity of a process with taskset, use the command

# taskset -c <CPU NUMBER> -p <PID>

where <CPU NUMBER> is the CPU number to assign the process to and <PID>
is the process PID to be assigned.

For example, to move process 5404 to CPU 2:

# taskset -c 2 -p 5404

See the taskset man page for more information on the taskset command.

When using isolated CPUs, specifying more than one CPU with the taskset command
will not result in an error, but only the first listed CPU will be used. Due to the nature of
isolated CPUs, specifying multiple CPUs is ineffective.

Using Cset To Assign A Process To An Isolated CPU

Define a cpuset:

# cset set --cpu <CPU> <CPUSET NAME>

where <CPU> is the CPU and <CPUSET NAME> is the name to give to
the cpuset.

Similar to taskset, it's possible to define more than one CPU in a cpuset,
however, due to the nature of isolated CPUs, only the first defined CPU will be
effective.

To move processes to a cpuset:

# cset proc --move --pid=<PID>,...,<PID> --toset=<CPUSET NAME>

where <PID> is one or more PIDs to be moved and <CPUSET NAME> is the
name given to the cpuset holding the desired CPU.

For example to implement the taskset example using cset:

# cset set --cpu 2 appcpu
# cset proc --move --pid 5404 --toset=appcpu

See the cset man page for more information on the cset command.





Additional Information

Since isolated CPUs are excluded from SMP balancing and the scheduler algorithm,
it's not desirable to use them in situations where you want a process balanced across
multiple CPUs. In such cases, shielding is more desirable (see the man page for
cset-shield). A discussion of shielding is out of scope of this document.

On NUMA machines, when using cset, it may be necessary to specify the memory nodes
as well as the CPUs. The command numactl --hardware can be used to determine the
desired memory nodes.

Disclaimer

This Support Knowledgebase provides a valuable tool for NetIQ/Novell/SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7009596
  • Creation Date:19-OCT-11
  • Modified Date:27-APR-12
    • SUSESUSE Linux Enterprise Server
< Back to Support Search

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center