- 查看cpu缓存
dmesg | grep cache
[root@VM-8-11-centos ~]# dmesg | grep cache
[ 0.334898] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[ 0.337183] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.339219] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.340991] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.846861] PCI: pci_cache_line_size set to 64 bytes
[ 1.228024] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
2.查看cpu各级缓存大小
ls /sys/devices/system/cpu/cpu0/cache/
[root@VM-8-11-centos ~]# ls /sys/devices/system/cpu/cpu0/cache/
index0 index1 index2 index3
[root@VM-8-11-centos ~]# cat /sys/devices/system/cpu/cpu0/cache/index0/size
32K
[root@VM-8-11-centos ~]# cat /sys/devices/system/cpu/cpu0/cache/index1/size
32K
[root@VM-8-11-centos ~]# cat /sys/devices/system/cpu/cpu0/cache/index2/size
4096K
[root@VM-8-11-centos ~]# cat /sys/devices/system/cpu/cpu0/cache/index3/size
36608K
lscpu
[root@VM-8-11-centos ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50GHz
Stepping: 5
CPU MHz: 2494.140
BogoMIPS: 4988.28
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
L3 cache: 36608K
NUMA node0 CPU(s): 0
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat avx512_vnni
查看缓存行大小
cat /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size
[root@VM-8-11-centos ~]# cat /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size
64