cputopology.txt 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. Export cpu topology info via sysfs. Items (attributes) are similar
  2. to /proc/cpuinfo.
  3. 1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
  4. represent the physical package id of cpu X;
  5. 2) /sys/devices/system/cpu/cpuX/topology/core_id:
  6. represent the cpu core id to cpu X;
  7. 3) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
  8. represent the thread siblings to cpu X in the same core;
  9. 4) /sys/devices/system/cpu/cpuX/topology/core_siblings:
  10. represent the thread siblings to cpu X in the same physical package;
  11. To implement it in an architecture-neutral way, a new source file,
  12. drivers/base/topology.c, is to export the 4 attributes.
  13. For an architecture to support this feature, it must define some of
  14. these macros in include/asm-XXX/topology.h:
  15. #define topology_physical_package_id(cpu)
  16. #define topology_core_id(cpu)
  17. #define topology_thread_siblings(cpu)
  18. #define topology_core_siblings(cpu)
  19. The type of **_id is int.
  20. The type of siblings is cpumask_t.
  21. To be consistent on all architectures, include/linux/topology.h
  22. provides default definitions for any of the above macros that are
  23. not defined by include/asm-XXX/topology.h:
  24. 1) physical_package_id: -1
  25. 2) core_id: 0
  26. 3) thread_siblings: just the given CPU
  27. 4) core_siblings: just the given CPU