Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to know how to find L2 cache size in Linux...

for L1 cache size, I am doing the following

pico /proc/cpuinfo

what about L2 cache size?

share|improve this question

migrated from stackoverflow.com Oct 15 '09 at 14:11

This question came from our site for professional and enthusiast programmers.

    
doesn't /proc/cpuinfo gives LLC size? – sud03r Dec 13 '13 at 9:27

EDIT 3: Heh, sorry, just do sudo dmidecode -t cache and it will show you your CPU's cache information. To tell what section you are looking at (L1 or L2), look at the Configuration: line. You want Configuration: Enabled, Not Socketed, Level 2.

share|improve this answer

cat /sys/devices/system/cpu/cpu0/cache/index2/size

or check dmidecode

or use lshw

share|improve this answer

You should check the following tool. It gives the most accurate information from all the tools I've tried. This is the command line version output:

~$ lstopo-no-graphics
Machine (7984MB)
  Socket L#0
    L2 L#0 (4096KB)
      L1d L#0 (32KB) + L1i L#0 (32KB) + Core L#0 + PU L#0 (P#0)
      L1d L#1 (32KB) + L1i L#1 (32KB) + Core L#1 + PU L#1 (P#1)
    L2 L#1 (4096KB)
      L1d L#2 (32KB) + L1i L#2 (32KB) + Core L#2 + PU L#2 (P#2)
      L1d L#3 (32KB) + L1i L#3 (32KB) + Core L#3 + PU L#3 (P#3)

And this is the graphical interface:enter image description here

share|improve this answer

dmesg | grep cache will show your L1 and L2 related information.

share|improve this answer
    
Or dmesg (or dmesg.boot) and search for the CPU model. Then google on that. – Hennes Nov 19 '12 at 0:26

Just use: lscpu

Sample output:

$ lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 42
Stepping:              7
CPU MHz:               3401.000
BogoMIPS:              6784.57
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K
NUMA node0 CPU(s):     0-3
share|improve this answer
    
lscpu is not accurate on some CPUs with exotic configuration. For example the CPU from my answer gives the following (omitted some info): CPU family: 6 Model: 15 Stepping: 11 CPU MHz: 1866.742 BogoMIPS: 3733.48 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 4096K NUMA node0 CPU(s): 0-3 The CPU is Xeon L5320 with 8MB L2 total. – zloster Feb 27 at 20:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.