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 5.10 and 6.5 (x64-bit) or newer, based on UEK R3 (Unbreakable Enterprise Kernel Release 3).
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 15 appears as cpu15.
ls /sys/devices/system/cpu/cpu*/online | wc -l
If hyperthreading is enabled, this returns the number of sockets x 30.
If hyperthreading is disabled, this returns the number of sockets x 15.
grep . /sys/devices/system/node*/cpulist
This returns a list of sockets and logical processors.
If hyperthreading is enabled, this returns two ranges of 15 logical processors per socket.
If hyperthreading is disabled, this returns one range of 15 logical processors per socket.
The following example shows a four-socket server with hyperthreading enabled:
# grep . /sys/devices/system/node*/cpulist socket 0: 0-14, 60-74 socket 1: 15-29, 75-89 socket 2: 30-44, 90-104 socket 3: 45-59, 105-119
For example, to deactivate the last core on the first socket on a four-socket server:
echo 0 > /sys/devices/system/cpu/cpu14/online deactivates logical processor 14.
echo 0 > /sys/devices/system/cpu/cpu74/online deactivates logical processor 74.
Disabling logical processor 74 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/cpu14/online to enable logical processor 14.
Enabling either logical processor activates the core.
echo 1 > /sys/devices/system/cpu/cpu74/online to enable logical processor 74.
Logical processor 74 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/cpu14/online # echo 0 > /sys/devices/system/cpu/cpu74/online # echo 0 > /sys/devices/system/cpu/cpu29/online # echo 0 > /sys/devices/system/cpu/cpu89/online # echo 0 > /sys/devices/system/cpu/cpu44/online # echo 0 > /sys/devices/system/cpu/cpu104/online # echo 0 > /sys/devices/system/cpu/cpu59/online # echo 0 > /sys/devices/system/cpu/cpu119/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/cpu14/online # echo 1 > /sys/devices/system/cpu/cpu74/online # echo 1 > /sys/devices/system/cpu/cpu29/online # echo 1 > /sys/devices/system/cpu/cpu89/online # echo 1 > /sys/devices/system/cpu/cpu44/online # echo 1 > /sys/devices/system/cpu/cpu104/online # echo 1 > /sys/devices/system/cpu/cpu59/online # echo 1 > /sys/devices/system/cpu/cpu119/online