System

Disable some CPUs within Red Hat Enterprise Linux 5 without rebooting the system

Warning: Check whether your hardware supports CPU hot swapping before experimenting with or using this command. Otherwise, your hardware may be damaged. Red Hat Enterprise 5 supports CPU hotplug, so CPUs can be disabled and enabled on the fly without restarting the machine. First, find out how many CPUs you have and which one you want to disable, using:

cat /proc/cpuinfo

This displays the CPUs recognized by the operating system. After running it, look at each processor line to identify the CPU to disable or enable. For example, processor : 0 means CPU0, while processor : 1 means CPU1. Next, disable a CPU by entering the command below:

echo 0 > /sys/devices/system/cpu/cpuX/online

To enable a CPU, enter:

echo 1 > /sys/devices/system/cpu/cpuX/online

In these examples, cpuX means CPU number X. The method for finding that number is explained above. Warning (again): Check whether your hardware supports CPU hot swapping before experimenting with or using this command. Otherwise, your hardware may be damaged.

EOF.← Back to articles