powerpc/pseries: Provide vcpu dispatch statistics
[linux-2.6-block.git] / arch / powerpc / mm / numa.c
index 50fadc99897b4dc685f37124ba5182117493cabd..26f479e6c8ede12283e86b0176d9599d87daa775 100644 (file)
@@ -167,6 +167,22 @@ static void unmap_cpu_from_node(unsigned long cpu)
 }
 #endif /* CONFIG_HOTPLUG_CPU || CONFIG_PPC_SPLPAR */
 
+int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
+{
+       int dist = 0;
+
+       int i, index;
+
+       for (i = 0; i < distance_ref_points_depth; i++) {
+               index = be32_to_cpu(distance_ref_points[i]);
+               if (cpu1_assoc[index] == cpu2_assoc[index])
+                       break;
+               dist++;
+       }
+
+       return dist;
+}
+
 /* must hold reference to node during call */
 static const __be32 *of_get_associativity(struct device_node *dev)
 {