728x90
반응형

문 서 명 : Linux CPU Core Disable manual

문 서 버 전 : Ver_1.0

문 서 구 분 :  Manual  □ Summary

작 성 일 : 2016 05 18

작 성 자 : 우리들의 삶

테 스 트 환 경 : RHEL 6.7

출 처 :  본인


해당 문서는 RHEL 6.7으로 Test 하였으며, RHEL 4, 5, 6 version에서 적용되는 것으로 보이며, S/W License issue 로 core 갯 수를 조정하고자 할 때 가이드 하면 될 것이다.

본 문서는 "임시로 core 갯수 조정" 하는 방법과 "영구적으로 core 갯수 조정" 하는 방법을 포함한다.



1. 임시로 core 갯수 조정(재부팅 없이 조정할 수 있으나, 재부팅 후 원래대로 돌아옴)

# CPU 확인
[root@hostname ~]# cat /sys/devices/system/cpu/online
0-23
[root@hostname ~]# cat /sys/devices/system/cpu/offline
24-31



[root@hostname ~]# cd /sys/devices/system/cpu/
[root@hostname cpu]# ls -al
합계 0
drwxr-xr-x 28 root root    0 2016-04-11 09:19 .
drwxr-xr-x 14 root root    0 2016-04-11 09:19 ..
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu0
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu1
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu10
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu11
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu12
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu13
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu14
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu15
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu16
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu17
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu18
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu19
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu2
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu20
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu21
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu22
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu23
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu3
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu4
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu5
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu6
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu7
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu8
drwxr-xr-x  8 root root    0 2016-04-11 09:20 cpu9
drwxr-xr-x  3 root root    0 2016-05-18 10:59 cpufreq
drwxr-xr-x  2 root root    0 2016-05-18 10:59 cpuidle
-r--r--r--  1 root root 4096 2016-04-12 00:00 kernel_max
-r--r--r--  1 root root 4096 2016-05-18 10:59 offline
-r--r--r--  1 root root 4096 2016-04-11 09:19 online
-r--r--r--  1 root root 4096 2016-04-12 00:00 possible
-r--r--r--  1 root root 4096 2016-04-12 00:00 present
-rw-r--r--  1 root root 4096 2016-04-11 09:20 sched_mc_power_savings
-rw-r--r--  1 root root 4096 2016-04-11 09:20 sched_smt_power_savings
[root@hostname cpu]#



[root@hostname cpu]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                24
On-line CPU(s) list:   0-23
Thread(s) per core:    2
Core(s) per socket:    6
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 44
Stepping:              2
CPU MHz:               1600.000
BogoMIPS:              6664.09
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              12288K
NUMA node0 CPU(s):     0,2,4,6,8,10,12,14,16,18,20,22
NUMA node1 CPU(s):     1,3,5,7,9,11,13,15,17,19,21,23
[root@bnpsvrdev01 cpu]#



[root@hostname cpu]# grep "processor" /proc/cpuinfo
processor       : 0
processor       : 1
processor       : 2
processor       : 3
processor       : 4
processor       : 5
processor       : 6
processor       : 7
processor       : 8
processor       : 9
processor       : 10
processor       : 11
processor       : 12
processor       : 13
processor       : 14
processor       : 15
processor       : 16
processor       : 17
processor       : 18
processor       : 19
processor       : 20
processor       : 21
processor       : 22
processor       : 23



임시로 CPU Core 갯 수 조정
[root@hostname cpu]# echo 0 > /sys/devices/system/cpu/cpu23/online
[root@hostname cpu]# echo 0 > /sys/devices/system/cpu/cpu22/online

혹은

[root@hostname ~]# chcpu -d 23
CPU 23 disabled
[root@hostname ~]# chcpu -d 22
CPU 22 disabled

* 두 명령어 모두 /sys/devices/system/cpu/cpu23/online 이라는 ASSCI TEXT 파일의 내용을  1 에서 0 으로 변경함으로
   CPU Core 상태를 Offline 으로 변경한다.


영구적으로 CPU Core 갯 수 조정

[root@hostname ~]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_bnp-LogVol00
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux 6 (2.6.32-573.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-573.el6.x86_64 ro root=/dev/mapper/vg_bnp-LogVol00 rd_NO_LUKS LANG=ko_KR.UTF-8 rd_NO_MD rd_LVM_LV=vg_bnp/LogVol00 crashkernel=128M  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_bnp/LogVol02 rd_NO_DM rhgb quiet maxcpus=8
        initrd /initramfs-2.6.32-573.el6.x86_64.img
[root@bnpsvrdev01 ~]#


* /etc/grub.conf 설정파일에서 kernel 부분에 maxcpus=N 구문을 삽입하여 부팅 시 변경하게끔 조정한다.
  이 방법은 최초 1회 재부팅이 필요하다.




728x90
반응형

+ Recent posts