different CPU cache size reported by /sys/device/ and dmidecode

前端 未结 1 965
灰色年华
灰色年华 2021-02-06 05:08

I\'m trying to get the size of different cache level in my system.

I tried two techniques.

a) Using information from /sys/device. Here is the output.

<         


        
相关标签:
1条回答
  • 2021-02-06 05:59

    A few things:

    1. You have a quad-core CPU
    2. The index<n> name in /sys/devices/system/cpu/cpu<n>/cache does not correspond to L1/L2/L3 etc. There is a .../index<n>/level file that will tell you the level of the cache.
    3. Your L1 cache is split into two caches (likely index0 and index1), one for data, and one for instructions (see .../index<n>/type), per core. 4 cores * 2 halves * 32K matches the 256K that dmidecode reports.
    4. The L2 cache is split per-core. 4 cores * 256K (from index2) = 1024K, which matches dmidecodes L2 number.
    0 讨论(0)
提交回复
热议问题