But did not find/sys/devices/system/CPU/cpu0/cache cache information folder, ls - al view, there is no hidden folder, did not point to other files,
Because a docker installation, configuration cgroup, may manage the CPU is to use cgroup, but why is lack of the cache folder?
When installing applications, such as k8s system, found that start kubelet error, the specific reason is that the CPU reads the cache file error, can not find the folder,
Specific reference source, specific as follows:
for independence idx, node:=range nodes {
Caches, err:=sysinfo. GetCacheInfo (sysFs, node. The Cores [0]. Threads [0])
if err ! Nil={
Klog. Errorf (" failed to get the cache information for node % d: % v ", node. The Id, err)
The continue
}
NumThreadsPerCore:=len (node. The Cores [0]. Threads)
NumThreadsPerNode:=len (node. Cores) * numThreadsPerCore
For _, cache:=range caches {
C:=info Cache {
Size: the cache Size,
Level: the cache Level,
Type: cache Type,
}
If the cache. Cpus==numThreadsPerNode & amp; & Cache. Level & gt; 2 {
//Add a node - level cache.
Nodes [r]. Independence idx AddNodeCache (c)
} else if cache. Cpus==numThreadsPerCore {
//Add to each core.
Nodes [r]. Independence idx AddPerCoreCache (c)
}
//Ignore unknown caches.
}
}
Return nodes, numCores, nil
}
func GetCacheInfo (sysFs sysFs. SysFs, id int) ([] sysFs CacheInfo, error) {
Caches, err:=sysFs GetCaches (id)
if err ! Nil={
Return nil, err
}
Info: []=sysfs. CacheInfo {}
For _, cache:=range caches {
if ! Strings. HasPrefix (cache. The Name (), "index") {
The continue
}
CacheInfo, err:=sysFs. GetCacheInfo (id, cache. The Name ())
if err ! Nil={
Return nil, err
}
Info=append (info, cacheInfo)
}
The return info, nil
}
func (self * realSysFs) GetCacheInfo (int id, name string) (CacheInfo, error) {
CachePath:=FMT. Sprintf (" % s % d/cache/% s ", cacheDir, id, name)
Out, err:=ioutil ReadFile (path. Join (cachePath, "/size"))
if err ! Nil={
Return CacheInfo {}, err
}
Var size uint64
N, err:=FMT. Sscanf (string (out), "% dK", & amp; The size)
if err !=nil | | n!={
1Return CacheInfo {}, err
}
//convert to bytes
Size=size * 1024
Out, err=ioutil. ReadFile (path. Join (cachePath, "/level"))
if err ! Nil={
Return CacheInfo {}, err
}
Var level int
N, err=FMT. Sscanf (string (out), "% d", & amp; Level)
if err !=nil | | n!={
1Return CacheInfo {}, err
}
Out, err=ioutil. ReadFile (path. Join (cachePath, "/type"))
if err ! Nil={
Return CacheInfo {}, err
}
CacheType:=strings. TrimSpace (string (out))
CpuCount, err:=getCpuCount (cachePath)
if err ! Nil={
Return CacheInfo {}, err
}
Return CacheInfo {
Size: the Size,
Level: Level,
Type: cacheType,
Cpus: cpuCount,
}, nil
}
This is the time to read the cache information and use the specific source of information, in fact, is through reading, found that in reading the cache files, and get the level of cache, the cache information such as the number, and then calculate the generated number of threads,
But reading is like that, why can not find a cache file?
How the centos7.8 arm64 CPU cache management? Which stage the cache is created? Why the lack of cache files? How to create a cache file?
I'm looking for the solution, request experts together to solve, is it centos7.8 version of the bug?
CodePudding user response:
Your top one, post don't sink