Skip to contentSkip to conversation

Fix mbind_migrate_pages

PATCH New Andi Kleen 1 participant 1 message Jan 10, 2009

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Fix mbind_migrate_pages

The nodemask conversion of mbind_mig_pages had some off by one bugs, making the program always fail on 2 node systems.

Noticed by Jay Weinstein.

/test/mbind_mig_pages.c renamed from test/mbind_mig_pages.c +2 -2
diff -urp numactl-2.0.2/test/mbind_mig_pages.c numactl-2.0.2-hack//test/mbind_mig_pages.c
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
 	/* Move to node zero */
 	printf("\nMoving pages via mbind to node 0 ...\n");
 	rc = mbind(pages, page_count * pagesize, MPOL_BIND, old_nodes->maskp,
-		old_nodes->size, MPOL_MF_MOVE | MPOL_MF_STRICT);
+		old_nodes->size + 1, MPOL_MF_MOVE | MPOL_MF_STRICT);
 	if (rc < 0) {
 		perror("mbind");
 		errors++;
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
 
 	printf("\nMoving pages via mbind from node 0 to 1 ...\n");
 	rc = mbind(pages, page_count * pagesize, MPOL_BIND, new_nodes->maskp,
-		new_nodes->size, MPOL_MF_MOVE | MPOL_MF_STRICT);
+		new_nodes->size + 1, MPOL_MF_MOVE | MPOL_MF_STRICT);
 	if (rc < 0) {
 		perror("mbind");
 		errors++;
Signature · 1 line
[email protected]