Skip to content
This repository
Browse code

move_pages09: move_pages returns 0 if nothing got migrated

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

commit e78bbfa
Author: Brice Goglin <Brice.Goglin@inria.fr>
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.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Caspar Zhang <caspar@casparzhang.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
  • Loading branch information...
commit 338299da1ff27c7815183c1b07eb91e705f117ce 1 parent 6e8e2be
Wanlong Gao gaowanlong authored

Showing 1 changed file with 20 additions and 7 deletions. Show diff stats Hide diff stats

  1. +20 7 testcases/kernel/syscalls/move_pages/move_pages09.c
27 testcases/kernel/syscalls/move_pages/move_pages09.c
@@ -105,12 +105,25 @@ int main(int argc, char **argv)
105 105 ret = numa_move_pages(0, TEST_PAGES, pages, nodes,
106 106 status, MPOL_MF_MOVE);
107 107 TEST_ERRNO = errno;
108   - if (ret == -1 && errno == ENOENT)
109   - tst_resm(TPASS, "move_pages failed with "
110   - "ENOENT as expected");
111   - else
112   - tst_resm(TFAIL, "move pages did not fail "
113   - "with ENOENT");
  108 +
  109 + /*
  110 + * commit e78bbfa8262424417a29349a8064a535053912b9
  111 + * Author: Brice Goglin <Brice.Goglin@inria.fr>
  112 + * Date: Sat Oct 18 20:27:15 2008 -0700
  113 + * mm: stop returning -ENOENT from sys_move_pages() if nothing got migrated
  114 + */
  115 + if ((tst_kvercmp(2, 6, 28)) >= 0) {
  116 + if (ret == 0)
  117 + tst_resm(TPASS, "move_pages succeeded");
  118 + else
  119 + tst_resm(TFAIL|TERRNO, "move_pages");
  120 + } else {
  121 + if (ret == -1 && errno == ENOENT)
  122 + tst_resm(TPASS, "move_pages failed with "
  123 + "ENOENT as expected");
  124 + else
  125 + tst_resm(TFAIL|TERRNO, "move_pages");
  126 + }
114 127
115 128 free_pages(pages, TEST_PAGES);
116 129 }
@@ -150,4 +163,4 @@ void cleanup(void)
150 163 */
151 164 TEST_CLEANUP;
152 165
153   - }
  166 + }

0 comments on commit 338299d

Please sign in to comment.
Something went wrong with that request. Please try again.