lost and found ( for me ? )

Linux : how to turn on/off CPU logically

I referred to the following URL.
CPU hotplug Support in Linux(tm) Kernel

[ procedure ]

# cat /etc/redhat-release
Scientific Linux release 6.0 (Carbon)
# uname -r
2.6.32-131.6.1.el6.x86_64


There are two CPUs.
# top -b -n 1 | egrep -i cpu[0-9]
Cpu0  :  0.1%us,  0.1%sy,  0.0%ni, 99.3%id,  0.5%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  0.0%us,  0.0%sy,  0.0%ni, 99.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

# egrep processor /proc/cpuinfo
processor       : 0
processor       : 1

# ls /sys/devices/system/cpu/
cpu0  cpu1  cpufreq  cpuidle  kernel_max  offline  online  possible  present

trun off CPU1 logically
# cat /sys/devices/system/cpu/cpu1/online
1

# echo 0 > /sys/devices/system/cpu/cpu1/online

# cat /sys/devices/system/cpu/cpu1/online
0

# dmesg
CPU 1 is now offline
SMP alternatives: switching to UP code

# egrep processor /proc/cpuinfo
processor       : 0

turn on CPU1 logically
# echo 1 > /sys/devices/system/cpu/cpu1/online

# dmesg
Booting Node 0 Processor 1 APIC 0x1

# head -2 /proc/interrupts
          CPU0       CPU1
 0:        114          1   IO-APIC-edge      timer

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.