Use this procedure to activate or deactivate cores using the Oracle Linux operating system. You can do this as often as you need, while the application is running.
Before You Begin
This task is supported on Oracle Linux Unbreakable Enterprise Kernel.
This task requires root privileges.
Elastic computing requires Intel Speed Step, which can be enabled or disabled in the Advanced - CPU Power Management Configuration screen in the BIOS Setup Utility. This setting is enabled by default.
In the Linux command line, logical processors are referred to as cpuNN, where NN is the logical processor number. For example, logical processor 18 appears as cpu18.
ls /sys/devices/system/cpu/cpu*/online | wc -l
If hyperthreading is enabled, this returns the number of sockets x 36.
If hyperthreading is disabled, this returns the number of sockets x 18.
grep . /sys/devices/system/node*/cpulist
This returns a list of sockets and logical processors.
If hyperthreading is enabled, this returns two ranges of 18 logical processors per socket.
If hyperthreading is disabled, this returns one range of 18 logical processors per socket.
The following example shows a four-socket server with hyperthreading enabled:
# grep . /sys/devices/system/node*/cpulist socket 0: 0-17, 72-89 socket 1: 18-35, 90-107 socket 2: 36-53, 108-125 socket 3: 54-71, 126-143
For example, to deactivate the last core on the first socket on a four-socket server:
echo 0 > /sys/devices/system/cpu/cpu17/online deactivates logical processor 17.
echo 0 > /sys/devices/system/cpu/cpu89/online deactivates logical processor 89.
Disabling logical processor 89 on a four-socket server is only necessary if hyperthreading is enabled.
For example, to activate the last core on the first socket on a four-socket server:
echo 1 > /sys/devices/system/cpu/cpu17/online to enable logical processor 17.
Enabling either logical processor activates the core.
echo 1 > /sys/devices/system/cpu/cpu89/online to enable logical processor 89.
Logical processor 89 only exists on a four-socket server if hyperthreading is enabled.
The following sample shows the commands to deactivate the last core on every socket of a four-socket server with hyperthreading enabled:
# echo 0 > /sys/devices/system/cpu/cpu17/online # echo 0 > /sys/devices/system/cpu/cpu89/online # echo 0 > /sys/devices/system/cpu/cpu35/online # echo 0 > /sys/devices/system/cpu/cpu107/online # echo 0 > /sys/devices/system/cpu/cpu53/online # echo 0 > /sys/devices/system/cpu/cpu125/online # echo 0 > /sys/devices/system/cpu/cpu71/online # echo 0 > /sys/devices/system/cpu/cpu143/online
The following sample shows how to reverse this action and reactivate all the logical processors and cores that were deactivated in the previous example:
# echo 1 > /sys/devices/system/cpu/cpu17/online # echo 1 > /sys/devices/system/cpu/cpu89/online # echo 1 > /sys/devices/system/cpu/cpu35/online # echo 1 > /sys/devices/system/cpu/cpu107/online # echo 1 > /sys/devices/system/cpu/cpu53/online # echo 1 > /sys/devices/system/cpu/cpu125/online # echo 1 > /sys/devices/system/cpu/cpu71/online # echo 1 > /sys/devices/system/cpu/cpu143/online