mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 07:51:31 -04:00
tools/power turbostat: Eliminate unnecessary data structure allocation
Linux core_id's are a per-package namespace, not a per-node namespace. Rename topo.cores_per_node to topo.cores_per_pkg to reflect this. Eliminate topo.nodes_per_pkg from the sizing for core data structures, since it has no role except to unnecessarily bloat the allocation. Validated on multiple Intel platforms (ICX/SPR/SRF/EMR/GNR/CWF) with various CPU online/offline configurations and SMT enabled/disabled scenarios. No functional changes. [lenb: commit message] Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
@@ -2409,7 +2409,7 @@ struct topo_params {
|
||||
int max_l3_id;
|
||||
int max_node_num;
|
||||
int nodes_per_pkg;
|
||||
int cores_per_node;
|
||||
int cores_per_pkg;
|
||||
int threads_per_core;
|
||||
} topo;
|
||||
|
||||
@@ -9633,9 +9633,9 @@ void topology_probe(bool startup)
|
||||
topo.max_core_id = max_core_id; /* within a package */
|
||||
topo.max_package_id = max_package_id;
|
||||
|
||||
topo.cores_per_node = max_core_id + 1;
|
||||
topo.cores_per_pkg = max_core_id + 1;
|
||||
if (debug > 1)
|
||||
fprintf(outf, "max_core_id %d, sizing for %d cores per package\n", max_core_id, topo.cores_per_node);
|
||||
fprintf(outf, "max_core_id %d, sizing for %d cores per package\n", max_core_id, topo.cores_per_pkg);
|
||||
if (!summary_only)
|
||||
BIC_PRESENT(BIC_Core);
|
||||
|
||||
@@ -9700,7 +9700,7 @@ void allocate_counters_1(struct counters *counters)
|
||||
void allocate_counters(struct counters *counters)
|
||||
{
|
||||
int i;
|
||||
int num_cores = topo.cores_per_node * topo.nodes_per_pkg * topo.num_packages;
|
||||
int num_cores = topo.cores_per_pkg * topo.num_packages;
|
||||
|
||||
counters->threads = calloc(topo.max_cpu_num + 1, sizeof(struct thread_data));
|
||||
if (counters->threads == NULL)
|
||||
|
||||
Reference in New Issue
Block a user