On 12/27/2024 3:51 PM, Zhao Liu wrote:
+static inline unsigned x86_module_per_pkg(X86CPUTopoInfo *topo_info)
+{
+    return topo_info->modules_per_die * topo_info->dies_per_pkg;
+}
+
+static inline unsigned x86_cores_per_pkg(X86CPUTopoInfo *topo_info)
+{
+    return topo_info->cores_per_module * x86_module_per_pkg(topo_info);
+}

The above helpers can be ignored this time until someone wants them...

x86_cores_per_pkg() will be used in next patch (06).

So the only one without a real user is x86_module_per_pkg(). We can drop it, and implement x86_cores_per_pkg() as

        return  topo_info->cores_per_module * topo_info->modules_per_die
                * topo_info->dies_per_pkg;

However, I don't see no real user as a big concern and I think current implementation looks more consistent and complete.

+static inline unsigned x86_threads_per_pkg(X86CPUTopoInfo *topo_info)
+{
+    return topo_info->threads_per_core * x86_cores_per_pkg(topo_info);
+}

...then this can be x86_threads_per_die(topo_info) * topo_info->dies_per_package

+static inline unsigned x86_threads_per_module(X86CPUTopoInfo *topo_info)
+{
+    return topo_info->threads_per_core * topo_info->cores_per_module;
+}
+
+static inline unsigned x86_threads_per_die(X86CPUTopoInfo *topo_info)
+{
+    return x86_threads_per_module(topo_info) * topo_info->modules_per_die;
+}
+



Reply via email to