mm: mempolicy: Hide MPOL_NOOP and MPOL_MF_LAZY from userspace for now

The use of MPOL_NOOP and MPOL_MF_LAZY to allow an application to
explicitly request lazy migration is a good idea but the actual
API has not been well reviewed and once released we have to support it.
For now this patch prevents an application using the services. This
will need to be revisited.

Signed-off-by: Mel Gorman <mgorman@suse.de>
This commit is contained in:
Mel Gorman 2012-11-16 09:37:58 +00:00
parent 4b10e7d562
commit a720094ded
2 changed files with 5 additions and 8 deletions

View File

@ -21,7 +21,6 @@ enum {
MPOL_BIND, MPOL_BIND,
MPOL_INTERLEAVE, MPOL_INTERLEAVE,
MPOL_LOCAL, MPOL_LOCAL,
MPOL_NOOP, /* retain existing policy for range */
MPOL_MAX, /* always last member of enum */ MPOL_MAX, /* always last member of enum */
}; };
@ -57,8 +56,7 @@ enum mpol_rebind_step {
#define MPOL_MF_VALID (MPOL_MF_STRICT | \ #define MPOL_MF_VALID (MPOL_MF_STRICT | \
MPOL_MF_MOVE | \ MPOL_MF_MOVE | \
MPOL_MF_MOVE_ALL | \ MPOL_MF_MOVE_ALL)
MPOL_MF_LAZY)
/* /*
* Internal flags that share the struct mempolicy flags word with * Internal flags that share the struct mempolicy flags word with

View File

@ -252,7 +252,7 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
pr_debug("setting mode %d flags %d nodes[0] %lx\n", pr_debug("setting mode %d flags %d nodes[0] %lx\n",
mode, flags, nodes ? nodes_addr(*nodes)[0] : -1); mode, flags, nodes ? nodes_addr(*nodes)[0] : -1);
if (mode == MPOL_DEFAULT || mode == MPOL_NOOP) { if (mode == MPOL_DEFAULT) {
if (nodes && !nodes_empty(*nodes)) if (nodes && !nodes_empty(*nodes))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
return NULL; return NULL;
@ -1186,7 +1186,7 @@ static long do_mbind(unsigned long start, unsigned long len,
if (start & ~PAGE_MASK) if (start & ~PAGE_MASK)
return -EINVAL; return -EINVAL;
if (mode == MPOL_DEFAULT || mode == MPOL_NOOP) if (mode == MPOL_DEFAULT)
flags &= ~MPOL_MF_STRICT; flags &= ~MPOL_MF_STRICT;
len = (len + PAGE_SIZE - 1) & PAGE_MASK; len = (len + PAGE_SIZE - 1) & PAGE_MASK;
@ -1241,7 +1241,7 @@ static long do_mbind(unsigned long start, unsigned long len,
flags | MPOL_MF_INVERT, &pagelist); flags | MPOL_MF_INVERT, &pagelist);
err = PTR_ERR(vma); /* maybe ... */ err = PTR_ERR(vma); /* maybe ... */
if (!IS_ERR(vma) && mode != MPOL_NOOP) if (!IS_ERR(vma))
err = mbind_range(mm, start, end, new); err = mbind_range(mm, start, end, new);
if (!err) { if (!err) {
@ -2530,7 +2530,6 @@ static const char * const policy_modes[] =
[MPOL_BIND] = "bind", [MPOL_BIND] = "bind",
[MPOL_INTERLEAVE] = "interleave", [MPOL_INTERLEAVE] = "interleave",
[MPOL_LOCAL] = "local", [MPOL_LOCAL] = "local",
[MPOL_NOOP] = "noop", /* should not actually be used */
}; };
@ -2581,7 +2580,7 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
break; break;
} }
} }
if (mode >= MPOL_MAX || mode == MPOL_NOOP) if (mode >= MPOL_MAX)
goto out; goto out;
switch (mode) { switch (mode) {