Rate This Document
Findability
Accuracy
Completeness
Readability

Encountering Hard-coded CPU Core Count

Symptom

The number of CPU cores on a Kunpeng server is different from that on an x86 server. Hard-coding the CPU core count within the module code limits the system's potential, leading to issues such as significant imbalances in core utilization or cross-NUMA node binding.

Procedure

You can search for the core binding interface (sched_setaffinity) in the code to check whether the number of CPU cores is hard-coded.

If yes, change the number of cores based on the actual number of cores on the Kunpeng server to eliminate hardcoding. You can obtain the actual number of cores by calling sysconf(_SC_NPROCESSORS_CONF) and then bind the cores.