Linux Hotplug a CPU How do I hotplug a CPU on a running Linux system? I would like to dynamically enable or disable a CPU on a running system?
Linux kernel does supports cpu-hotplug mechanism. You can enable or disable CPU without a system reboot. CPU hotplug is not just useful to replace defective components it can also be applied in other contexts to increase the productivity of a system. For example on a single system running multiple Linux partitions, as the workloads change it would be extremely useful to be able to move CPUs from one partition to the next as required without rebooting or interrupting the workloads. This is known as dynamic partitioning. Other applications include Instant Capacity on Demand where extra CPUs are present in a system but aren't activated. This is useful for customers that predict growth and therefore the need for more computing power but do not have at the time of purchase the means to afford. List all current cpus in the system Type the following command: # cd /sys/devices/system/cpu # ls -l Sample output: total 0 drwxr-xr-x 4 root root 0 Apr 2 12:03 cpu0 drwxr-xr-x 4 root root 0 Feb 15 07:06 cpu1 drwxr-xr-x 4 root root 0 Feb 15 07:06 cpu2 drwxr-xr-x 4 root root 0 Feb 15 07:06 cpu3 drwxr-xr-x 4 root root 0 Feb 15 07:06 cpu4 drwxr-xr-x 4 root root 0 Feb 15 07:06 cpu5 drwxr-xr-x 4 root root 0 Feb 15 07:06 cpu6 drwxr-xr-x 4 root root 0 Feb 15 07:06 cpu7 -rw-r--r-- 1 root root 4096 Apr 2 12:03 sched_mc_power_savings Under each directory you would find an "online" file which is the control file to logically online/offline a processor. How do I logically turn off (offline) cpu#6 ? Type the following command: # echo 0 > /sys/devices/system/cpu/cpu6/online # grep "processor" /proc/cpuinfo How do I logically turn on (online) cpu#6 ? Type the following command: # echo 1 > /sys/devices/system/cpu/cpu6/online # grep "processor" /proc/cpuinfo Once done, you can can actually remove CPU if your BIOS and vendor supports such operation. -- Thanks & Regards Sunil Naikwadi 9820668120 "Think positive in life always and look for opportunities when u can help Others." [Non-text portions of this message have been removed]
