diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2012-10-25 08:16:28 -0400 |
---|---|---|
committer | Mel Gorman <mgorman@suse.de> | 2012-12-11 09:42:39 -0500 |
commit | 479e2802d09f1e18a97262c4c6f8f17ae5884bd8 (patch) | |
tree | 7b18bff361b049d04619b196367a95463a2f1417 /mm | |
parent | d10e63f29488b0f312a443f9507ea9b6fd3c9090 (diff) |
mm: mempolicy: Make MPOL_LOCAL a real policy
Make MPOL_LOCAL a real and exposed policy such that applications that
relied on the previous default behaviour can explicitly request it.
Requested-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mempolicy.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 66e90ecc2350..54bd3e5ed776 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -269,6 +269,10 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags, | |||
269 | (flags & MPOL_F_RELATIVE_NODES))) | 269 | (flags & MPOL_F_RELATIVE_NODES))) |
270 | return ERR_PTR(-EINVAL); | 270 | return ERR_PTR(-EINVAL); |
271 | } | 271 | } |
272 | } else if (mode == MPOL_LOCAL) { | ||
273 | if (!nodes_empty(*nodes)) | ||
274 | return ERR_PTR(-EINVAL); | ||
275 | mode = MPOL_PREFERRED; | ||
272 | } else if (nodes_empty(*nodes)) | 276 | } else if (nodes_empty(*nodes)) |
273 | return ERR_PTR(-EINVAL); | 277 | return ERR_PTR(-EINVAL); |
274 | policy = kmem_cache_alloc(policy_cache, GFP_KERNEL); | 278 | policy = kmem_cache_alloc(policy_cache, GFP_KERNEL); |
@@ -2399,7 +2403,6 @@ void numa_default_policy(void) | |||
2399 | * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag | 2403 | * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag |
2400 | * Used only for mpol_parse_str() and mpol_to_str() | 2404 | * Used only for mpol_parse_str() and mpol_to_str() |
2401 | */ | 2405 | */ |
2402 | #define MPOL_LOCAL MPOL_MAX | ||
2403 | static const char * const policy_modes[] = | 2406 | static const char * const policy_modes[] = |
2404 | { | 2407 | { |
2405 | [MPOL_DEFAULT] = "default", | 2408 | [MPOL_DEFAULT] = "default", |
@@ -2452,12 +2455,12 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2452 | if (flags) | 2455 | if (flags) |
2453 | *flags++ = '\0'; /* terminate mode string */ | 2456 | *flags++ = '\0'; /* terminate mode string */ |
2454 | 2457 | ||
2455 | for (mode = 0; mode <= MPOL_LOCAL; mode++) { | 2458 | for (mode = 0; mode < MPOL_MAX; mode++) { |
2456 | if (!strcmp(str, policy_modes[mode])) { | 2459 | if (!strcmp(str, policy_modes[mode])) { |
2457 | break; | 2460 | break; |
2458 | } | 2461 | } |
2459 | } | 2462 | } |
2460 | if (mode > MPOL_LOCAL) | 2463 | if (mode >= MPOL_MAX) |
2461 | goto out; | 2464 | goto out; |
2462 | 2465 | ||
2463 | switch (mode) { | 2466 | switch (mode) { |