List CPU Caches and Their Sizes

This section describes how to use 'lscpu', 'lshw' and 'dmidecode' commands to list CPU caches and their sizes.

You can different Linux commands to list CPU caches and their sizes, lscpu, lshw and dmidecode, as described below.

"lscpu" - Display CPU Caches - "lscpu" command displays information about the CPU and its caches. The following output shows 4 CPU caches.

herong$ lscpu 

Architecture:        x86_64
Byte Order:          Little Endian
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  2
Core(s) per socket:  1
Socket(s):           1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) Silver 4210R CPU @ 2.40GHz
CPU MHz:             2400.000
...

L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            14080K

"lshw" - Display CPU Caches - "lshw" command displays hardware configurations including CPU caches. The following output shows multiple CPUs with 3 caches connected each CPU.

herong$ sudo lscpu

localhost.localdomain       
  *-core
    description: Motherboard
    *-cpu:0
          slot: CPU1
          width: 64 bits
          clock: 1010MHz
        *-cache:0
            description: L1 cache
            physical id: 700
            size: 640KiB
            configuration: level=1
        *-cache:1
            description: L2 cache
            physical id: 701
            size: 10MiB
            configuration: level=2
        *-cache:2
            description: L3 cache
            physical id: 702
            size: 13MiB
            configuration: level=3
    *-cpu:1
          slot: CPU2
          width: 64 bits
          clock: 1010MHz
        *-cache:0
            description: L1 cache
            physical id: 703
            size: 640KiB
            configuration: level=1
        *-cache:1
            description: L2 cache
            physical id: 704
            size: 10MiB
            configuration: level=2
        *-cache:2
            description: L3 cache
            physical id: 705
            size: 13MiB
            configuration: level=3
    ...

"dmidecode" - Display CPU Caches - "dmidecode" command decodes DMI (Direct Media Interface), also called SMBIOS, information including CPU caches. The following output shows 3 CPU caches:

herong$ sudo dmidecode

# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.
Table at 0x68E38000.
...

Handle 0x003E, DMI type 7, 19 bytes
Cache Information
        Socket Designation: CPU Internal L2
        Configuration: Enabled, Not Socketed, Level 2
        Operational Mode: Write Back
        Location: Internal
        Installed Size: 1 MB

Handle 0x003F, DMI type 7, 19 bytes
Cache Information
        Socket Designation: CPU Internal L1
        Configuration: Enabled, Not Socketed, Level 1
        Operational Mode: Write Back
        Location: Internal
        Installed Size: 256 kB

Handle 0x0040, DMI type 7, 19 bytes
Cache Information
        Socket Designation: CPU Internal L3
        Configuration: Enabled, Not Socketed, Level 3
        Operational Mode: Write Back
        Location: Internal
        Installed Size: 8 MB

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

Memory Management

 Layers of Memory and Access Speed

List CPU Caches and Their Sizes

 Virtual Memory vs. Physical Memory

 Buffer Memory and Cache Memory

 Verify Cache Memory with "cp" Command

 What Is Swap Space

 Virtual Memory Mapping and Page Table

 "ps -o rss,drs,trs,vsz,sz" - Process Status Options

 smem - Process Memory Usage Report

 pmap - Process Memory Map

 /proc/{id}/maps - Process Memory Map

 /proc/{id}/smaps - Process Memory Map Details

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Software Package Manager on CentOS - DNF and YUM

 vsftpd - Very Secure FTP Daemon

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB