<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:monospace"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 29, 2021 at 3:25 PM Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br>
---<br>
testcases/kernel/syscalls/mbind/mbind01.c | 25 ++++++++++++++++++++---<br>
1 file changed, 22 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c<br>
index d2cf13c8f..b5c1e948d 100644<br>
--- a/testcases/kernel/syscalls/mbind/mbind01.c<br>
+++ b/testcases/kernel/syscalls/mbind/mbind01.c<br>
@@ -34,7 +34,7 @@ static struct bitmask *nodemask, *getnodemask, *empty_nodemask;<br>
static void test_default(unsigned int i, char *p);<br>
static void test_none(unsigned int i, char *p);<br>
static void test_invalid_nodemask(unsigned int i, char *p);<br>
-static void check_policy_pref_no_target(int);<br>
+static void check_policy_pref_or_local(int);<br>
<br>
struct test_case {<br>
int policy;<br>
@@ -92,7 +92,7 @@ static struct test_case tcase[] = {<br>
.ret = 0,<br>
.err = 0,<br>
.test = test_none,<br>
- .check_policy = check_policy_pref_no_target,<br>
+ .check_policy = check_policy_pref_or_local,<br>
},<br>
{<br>
POLICY_DESC(MPOL_PREFERRED),<br>
@@ -101,6 +101,20 @@ static struct test_case tcase[] = {<br>
.test = test_default,<br>
.exp_nodemask = &nodemask,<br>
},<br>
+ {<br>
+ POLICY_DESC(MPOL_LOCAL),<br>
+ .ret = 0,<br>
+ .err = 0,<br>
+ .test = test_none,<br>
+ .exp_nodemask = &empty_nodemask,<br>
+ .check_policy = check_policy_pref_or_local,<br></blockquote><div><br></div><div><div style="font-family:monospace" class="gmail_default">This is a bit more permissive, it allows for MPOL_LOCAL to return also MPOL_PREFERRED.</div><div style="font-family:monospace" class="gmail_default">
</div><div style="font-family:monospace" class="gmail_default">Shouldn't that still be treated as error?<br></div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ },<br>
+ {<br>
+ POLICY_DESC_TEXT(MPOL_LOCAL, "target exists"),<br>
+ .ret = -1,<br>
+ .err = EINVAL,<br>
+ .test = test_default,<br>
+ },<br>
{<br>
POLICY_DESC(UNKNOWN_POLICY),<br>
.ret = -1,<br>
@@ -122,7 +136,7 @@ static struct test_case tcase[] = {<br>
},<br>
};<br>
<br>
-static void check_policy_pref_no_target(int policy)<br>
+static void check_policy_pref_or_local(int policy)<br>
{<br>
if (policy != MPOL_PREFERRED && policy != MPOL_LOCAL) {<br>
tst_res(TFAIL, "Wrong policy: %s(%d), "<br>
@@ -182,6 +196,11 @@ static void do_test(unsigned int i)<br>
<br>
tst_res(TINFO, "case %s", tc->desc);<br>
<br>
+ if ((tst_kvercmp(3, 8, 0)) < 0 && (tc->policy == MPOL_LOCAL)) {<br>
+ tst_res(TCONF, "%s is not supported", tst_mempolicy_mode_name(tc->policy));<br>
+ return;<br>
+ }<br></blockquote><div><br></div><div><div style="font-family:monospace" class="gmail_default">I was thinking of runtime check (to support also downstream kernels that backported it),</div><div style="font-family:monospace" class="gmail_default">but I don't have strong opinion.<br></div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
setup_node();<br>
<br>
p = SAFE_MMAP(NULL, MEM_LENGTH, PROT_READ | PROT_WRITE, MAP_PRIVATE |<br>
-- <br>
2.31.1<br>
<br>
</blockquote></div></div>