2016-09-20 1 views
4

두 개의 리눅스 시스템을 점검했습니다. 둘 다 64 비트이지만 PID_MAX는 둘 다 다릅니다. 하나 개의 시스템에리눅스에서 PID_MAX가 의존하는 요인은 무엇입니까?

(SYSTEM1)

cat /proc/sys/kernel/pid_max 
32768 

SYSTEM1 구성 :

dmesg를 | -i SMP를 grep으로 * 기타 (시스템 2)에 반면

getconf PAGESIZE 
4096 

cat /proc/cpuinfo | awk '/^processor/{print $3}' | tail -1 
11 
cat /proc/cpuinfo 
processor : 0 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 2201.000 
cache size : 15360 KB 
physical id : 0 
siblings : 6 
core id  : 0 
cpu cores : 6 
apicid  : 0 
initial apicid : 0 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4389.48 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 1 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 2201.000 
cache size : 15360 KB 
physical id : 0 
siblings : 6 
core id  : 1 
cpu cores : 6 
apicid  : 2 
initial apicid : 2 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4389.48 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 2 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 2201.000 
cache size : 15360 KB 
physical id : 0 
siblings : 6 
core id  : 2 
cpu cores : 6 
apicid  : 4 
initial apicid : 4 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4389.48 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 3 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 1300.000 
cache size : 15360 KB 
physical id : 0 
siblings : 6 
core id  : 3 
cpu cores : 6 
apicid  : 6 
initial apicid : 6 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4389.48 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 4 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 2201.000 
cache size : 15360 KB 
physical id : 0 
siblings : 6 
core id  : 4 
cpu cores : 6 
apicid  : 8 
initial apicid : 8 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4389.48 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 5 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 1200.000 
cache size : 15360 KB 
physical id : 0 
siblings : 6 
core id  : 5 
cpu cores : 6 
apicid  : 10 
initial apicid : 10 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4389.48 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 6 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 2201.000 
cache size : 15360 KB 
physical id : 1 
siblings : 6 
core id  : 0 
cpu cores : 6 
apicid  : 32 
initial apicid : 32 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4392.34 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 7 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 2201.000 
cache size : 15360 KB 
physical id : 1 
siblings : 6 
core id  : 1 
cpu cores : 6 
apicid  : 34 
initial apicid : 34 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4392.34 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 8 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 2201.000 
cache size : 15360 KB 
physical id : 1 
siblings : 6 
core id  : 2 
cpu cores : 6 
apicid  : 36 
initial apicid : 36 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4392.34 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 9 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 2201.000 
cache size : 15360 KB 
physical id : 1 
siblings : 6 
core id  : 3 
cpu cores : 6 
apicid  : 38 
initial apicid : 38 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4392.34 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 10 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 1200.000 
cache size : 15360 KB 
physical id : 1 
siblings : 6 
core id  : 4 
cpu cores : 6 
apicid  : 40 
initial apicid : 40 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4392.34 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

processor : 11 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 45 
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz 
stepping : 7 
microcode : 1803 
cpu MHz  : 1200.000 
cache size : 15360 KB 
physical id : 1 
siblings : 6 
core id  : 5 
cpu cores : 6 
apicid  : 42 
initial apicid : 42 
fpu  : yes 
fpu_exception : yes 
cpuid level : 13 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid 
bogomips : 4392.34 
clflush size : 64 
cache_alignment : 64 
address sizes : 46 bits physical, 48 bits virtual 
power management: 

을 허용, 그것은

cat /proc/sys/kernel/pid_max 
65536 

시스템 2의 구성이었다.

dmesg를 | -i SMP를 grep으로 *이

SMP를 허용 :. 64 개 CPU를, 맨 페이지에서 61 개 핫 플러그 ​​CPU를

getconf PAGESIZE 
4096 

cat /proc/cpuinfo | awk '/^processor/{print $3}' | tail -1 
2 

cat /proc/cpuinfo 
processor : 0 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 23 
model name : Intel(R) Xeon(R) CPU   X5450 @ 3.00GHz 
stepping : 6 
microcode : 4294967295 
cpu MHz  : 2992.467 
cache size : 6144 KB 
physical id : 0 
siblings : 3 
core id  : 0 
cpu cores : 3 
apicid  : 0 
initial apicid : 0 
fpu  : yes 
fpu_exception : yes 
cpuid level : 10 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good unfair_spinlock pni ssse3 cx16 sse4_1 hypervisor lahf_lm 
bogomips : 5984.93 
clflush size : 64 
cache_alignment : 64 
address sizes : 38 bits physical, 48 bits virtual 
power management: 

processor : 1 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 23 
model name : Intel(R) Xeon(R) CPU   X5450 @ 3.00GHz 
stepping : 6 
microcode : 4294967295 
cpu MHz  : 2992.467 
cache size : 6144 KB 
physical id : 0 
siblings : 3 
core id  : 1 
cpu cores : 3 
apicid  : 1 
initial apicid : 1 
fpu  : yes 
fpu_exception : yes 
cpuid level : 10 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good unfair_spinlock pni ssse3 cx16 sse4_1 hypervisor lahf_lm 
bogomips : 5984.93 
clflush size : 64 
cache_alignment : 64 
address sizes : 38 bits physical, 48 bits virtual 
power management: 

processor : 2 
vendor_id : GenuineIntel 
cpu family : 6 
model  : 23 
model name : Intel(R) Xeon(R) CPU   X5450 @ 3.00GHz 
stepping : 6 
microcode : 4294967295 
cpu MHz  : 2992.467 
cache size : 6144 KB 
physical id : 0 
siblings : 3 
core id  : 2 
cpu cores : 3 
apicid  : 2 
initial apicid : 2 
fpu  : yes 
fpu_exception : yes 
cpuid level : 10 
wp  : yes 
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good unfair_spinlock pni ssse3 cx16 sse4_1 hypervisor lahf_lm 
bogomips : 5984.93 
clflush size : 64 
cache_alignment : 64 
address sizes : 38 bits physical, 48 bits virtual 
power management: 

허용.

PROC/SYS/커널 (리눅스 2.5 신규)/pid_max이 파일의 PID는 (즉,이 파일의 값은 PID 최대 이상의 크다) 랩 어라운드되는 값을 지정한다. 이 파일의 기본값 ( 32768)은 이전 커널에서와 동일한 PID 범위를 갖습니다. 32 비트 플랫폼에서 32768은 pid_max의 최대 값입니다. 64 비트 시스템에서 pid_max는 최대 2^22 (PID_MAX_LIMIT, 약 4 백만)까지의 값으로 설정할 수 있습니다.

두 시스템 모두 Linux 커널이 동일하지만 SYSTEM2는 Hyper-V에서 실행되고 있습니다.

자, 내 질문은 pid_max를 변경하는 요인은 무엇입니까? 미리 감사드립니다.

+2

질문에 대답하려면 두 시스템에 대한 추가 데이터를 알아야합니다. (1) 컴퓨터가 핫 플러그 ​​형 CPU를 지원합니까? (2) 각 머신에 대해 PAGE_SIZE는 무엇입니까? (3) 각 머신의 CPU 수는 얼마입니까? (4) 각각의 머신에 대한'/ boot/config *'의'CONFIG_BASE_SMALL' 값은 얼마입니까? –

+0

이 정보를 제공 할 수 있지만 pid_max 값을 변경할 수있는 요소를 알고 싶습니다. –

+1

시스템의 페이지 크기와 CPU 수 (시스템이 CPU 핫 플러깅을 허용하는지 여부에 따라 현재 또는 가능). 아직도, 당신이 나에게 당신의 params (나의 이전 코멘트에서 언급했다)를 주면, 나는 더 구체적인 대답을 제공 할 수있다. –

답변

5

pid_max은 당신이 (핫 플러그 ​​CPU를 시스템에있을 수있는 CPU의 최대 수를 포함 pid.c line 597

pid_max = min(pid_max_max, max_t(int, pid_max, 
      PIDS_PER_CPU_DEFAULT * num_possible_cpus())); 

num_possible_cpus() 반환에 커널 소스에서 볼 수있는 가능한 CPU의 수에 따라 설정된다 부팅 후 플러그 인 가능).

표현식에서 알 수 있듯이 표현식에는 최소값과 최대 값이 있습니다.

최소값은 PID_MAX_DEFAULT 매크로에서 파생 된 pid_max의 초기 값입니다.이 값은 컴파일 타임 구성 설정 CONFIG_BASE_SMALL에 따라 0x1000 또는 0x8000입니다.

최대 값은 pid_max_max이며 이는 차례로 커널 컴파일 타임 구성 설정, 특히 CONFIG_BASE_SMALL 및 PAGE_SIZE에서 파생됩니다.

#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ 
    (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) 

그래서 예에서 함께 모든 것을 넣어 :이 작업은 매크로 PID_MAX_LIMIT see threads.h line 33에 정의되어 여기 내 시스템에 (를 CentOS 6) :

  • PAGESIZE가 CONFIG_BASE_SMALL 0
  • 4096
  • 입니다
  • 따라서 PID_MAX_DEFAULT는 0x8000 (32768)입니다.
  • PID_MAX_LIMIT는 4 * 1024 * 1024 = 4194304
  • 입니다.
  • max_pid 그러므로 당신이 파일 /sys/devices/system/cpu/possible 가능한 CPU의 수를 검사 할 수 있습니다, 범위 유저 랜드에서 4194304 <= max_pid <= 32768

에있을 것입니다. 이 파일의 데이터 형식은 다소 이상합니다. 형식은 0-max입니다. 예를 들어 0-15은 최대 16 개의 CPU를 의미합니다 (숫자는 0으로 계산 됨).

이 파일과이 디렉터리의 다른 파일에 대한 자세한 내용은 cputopology.txt을 참조하십시오. 당신이 커널 컴파일 시간 구성 설정을 확인 몇 가지 팁 this answer을 확인하려면

일반적으로 CPU의 핫 플러그에 대한 자세한 내용은 cpu-hotplug.txt

를 참조하십시오.

NB. 주어진 커널 행 번호는 커널 4.7에서 유효합니다.

+0

이 정보를 제공해 주셔서 감사합니다. 어떤 시스템에서 가능한 CPU 수를 얻는 지 알려주십시오. 명령/구성이 있습니까? –

+0

@SACHINGOYAL 답이 num을 보는 방법을 보여주는 조금 더 많은 정보로 업데이트되었습니다. 가능한 CPU – harmic

+0

64 비트 커널의 경우, 시스템 1에서/pid_max가 24576 대신 32768 인 이유는/sys/devices/system/cpu/possible = 0-23.so "PIDS_PER_CPU_DEFAULT * num_possible_cpus()"= 1024 * 24 = 24576입니다. ? 제가 간과한다면 알려주세요. –

관련 문제