Skip to contentSkip to conversation

move_pages09: move_pages returns 0 if nothing got migrated

PATCH Superseded Jan Stancek 2 participants 2 messages May 9, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 move_pages09: move_pages returns 0 if nothing got migrated

Following commit changed the behavior to return 0 when no pages require migration.

commit e78bbfa8262424417a29349a8064a535053912b9

Author: Brice Goglin <[email protected]>
Date:   Sat Oct 18 20:27:15 2008 -0700

mm: stop returning -ENOENT from sys_move_pages() if nothing got
migrated

So testing for ENOENT in move_pages09, makes sense only for kernel < 2.6.28.

---
 .../kernel/syscalls/move_pages/move_pages09.c      |   29 +++++++++++++++-----
 1 files changed, 22 insertions(+), 7 deletions(-)
testcases/kernel/syscalls/move_pages/move_pages09.c +22 -7
index 4cedb6a..e00fcca 100644
@@ -105,12 +105,27 @@ int main(int argc, char **argv)
 		ret = numa_move_pages(0, TEST_PAGES, pages, nodes,
 				      status, MPOL_MF_MOVE);
 		TEST_ERRNO = errno;
-		if (ret == -1 && errno == ENOENT)
-			tst_resm(TPASS, "move_pages failed with "
-				 "ENOENT as expected");
-		else
-			tst_resm(TFAIL, "move pages did not fail "
-				 "with ENOENT");
+
+		/*
+		 * commit e78bbfa8262424417a29349a8064a535053912b9
+		 * Author: Brice Goglin <[email protected]>
+		 * Date:   Sat Oct 18 20:27:15 2008 -0700
+		 *     mm: stop returning -ENOENT from sys_move_pages() if nothing got migrated
+		 */
+		if ((tst_kvercmp(2, 6, 28)) >= 0) {
+			if (ret == 0)
+				tst_resm(TPASS, "move_pages succeeded");
+			else
+				tst_resm(TFAIL, "move_pages failed with: %s",
+				    strerror(TEST_ERRNO));
+		} else {
+			if (ret == -1 && errno == ENOENT)
+				tst_resm(TPASS, "move_pages failed with "
+				    "ENOENT as expected");
+			else
+				tst_resm(TFAIL, "move_pages failed with: "
+				    "%s", strerror(TEST_ERRNO));
+		}
 
 		free_pages(pages, TEST_PAGES);
 	}
@@ -150,4 +165,4 @@ void cleanup(void)
 	 */
 	TEST_CLEANUP;
 
- }
\ No newline at end of file
+ }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

testcases/kernel/syscalls/move_pages/move_pages09.c int main(int argc, char **argv) · line 120

Quoted 6 lines · Jan Stancek
testcases/kernel/syscalls/move_pages/move_pages09.c +6 -0
+		if ((tst_kvercmp(2, 6, 28)) >= 0) {
+			if (ret == 0)
+				tst_resm(TPASS, "move_pages succeeded");
+			else
+				tst_resm(TFAIL, "move_pages failed with: %s",
+				    strerror(TEST_ERRNO));

Hi Jan,

We can use: tst_resm(TFAIL|TERRNO, "move_pages");

This will produce messages like:

TFAIL : move_pages: errno=ENOENT(2): No such file or directory

testcases/kernel/syscalls/move_pages/move_pages09.c int main(int argc, char **argv) · line 127

Quoted 7 lines
testcases/kernel/syscalls/move_pages/move_pages09.c +7 -0
+		} else {
+			if (ret == -1 && errno == ENOENT)
+				tst_resm(TPASS, "move_pages failed with "
+				    "ENOENT as expected");
+			else
+				tst_resm(TFAIL, "move_pages failed with: "
+				    "%s", strerror(TEST_ERRNO));

Here as well.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list