Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

From: Borislav Petkov
Date: Fri Jul 08 2016 - 14:41:26 EST


On Fri, Jul 08, 2016 at 08:07:46PM +0200, Ingo Molnar wrote:
> Who can we ... thank for that nonsensical naming? :-/
>
> > E.g. on most Intel cpus you'll typically find "index0" is the L1-data cache,
> > "index1" is the L1-instruction cache, "index3" is the L2-unified cache and
> > "index4" is the L3-unified cache.
>
> Crazy. What was wrong with using 'level' or 'depth'?

It is all there:

$ grep . /sys/devices/system/cpu/cpu0/cache/index?/level
/sys/devices/system/cpu/cpu0/cache/index0/level:1
/sys/devices/system/cpu/cpu0/cache/index1/level:1
/sys/devices/system/cpu/cpu0/cache/index2/level:2
/sys/devices/system/cpu/cpu0/cache/index3/level:3
$ grep . /sys/devices/system/cpu/cpu0/cache/index?/type
/sys/devices/system/cpu/cpu0/cache/index0/type:Data
/sys/devices/system/cpu/cpu0/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu0/cache/index2/type:Unified
/sys/devices/system/cpu/cpu0/cache/index3/type:Unified



for i in /sys/devices/system/cpu/cpu0/cache/index?;
do
l=$(cat $i/level)
t=$(cat $i/type)

printf "L%d-%s\n" $l $t
done

->

L1-Data
L1-Instruction
L2-Unified
L3-Unified

I believe the index naming is simply enumerating the caches...

--
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix ImendÃrffer, Jane Smithard, Graham Norton, HRB 21284 (AG NÃrnberg)
--