Blob Blame History Raw
diff --git a/cputree.c b/cputree.c
index 4d09c0e..0f14cfb 100644
--- a/cputree.c
+++ b/cputree.c
@@ -357,6 +357,8 @@ static void do_one_cpu(char *path)
 
 	nodeid=-1;
 	if (numa_avail) {
+		struct topo_obj *node;
+
 		dir = opendir(path);
 		do {
 			entry = readdir(dir);
@@ -368,6 +370,12 @@ static void do_one_cpu(char *path)
 			}
 		} while (entry);
 		closedir(dir);
+
+		node = get_numa_node(nodeid);
+		if (node && (cpus_weight(package_mask) > cpus_weight(node->mask))) {
+			cpus_and(package_mask, package_mask, node->mask);
+			packageid = nodeid;
+		}
 	}
 
 	/*