diff options
-rw-r--r-- | mm/mempolicy.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index b4f1265df2d8..ade57322fa2a 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -2121,9 +2121,15 @@ void numa_default_policy(void) | |||
2121 | * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag | 2121 | * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag |
2122 | * Used only for mpol_parse_str() and mpol_to_str() | 2122 | * Used only for mpol_parse_str() and mpol_to_str() |
2123 | */ | 2123 | */ |
2124 | #define MPOL_LOCAL (MPOL_INTERLEAVE + 1) | 2124 | #define MPOL_LOCAL MPOL_MAX |
2125 | static const char * const policy_types[] = | 2125 | static const char * const policy_modes[] = |
2126 | { "default", "prefer", "bind", "interleave", "local" }; | 2126 | { |
2127 | [MPOL_DEFAULT] = "default", | ||
2128 | [MPOL_PREFERRED] = "prefer", | ||
2129 | [MPOL_BIND] = "bind", | ||
2130 | [MPOL_INTERLEAVE] = "interleave", | ||
2131 | [MPOL_LOCAL] = "local" | ||
2132 | }; | ||
2127 | 2133 | ||
2128 | 2134 | ||
2129 | #ifdef CONFIG_TMPFS | 2135 | #ifdef CONFIG_TMPFS |
@@ -2169,7 +2175,7 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2169 | *flags++ = '\0'; /* terminate mode string */ | 2175 | *flags++ = '\0'; /* terminate mode string */ |
2170 | 2176 | ||
2171 | for (mode = 0; mode <= MPOL_LOCAL; mode++) { | 2177 | for (mode = 0; mode <= MPOL_LOCAL; mode++) { |
2172 | if (!strcmp(str, policy_types[mode])) { | 2178 | if (!strcmp(str, policy_modes[mode])) { |
2173 | break; | 2179 | break; |
2174 | } | 2180 | } |
2175 | } | 2181 | } |
@@ -2324,11 +2330,11 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) | |||
2324 | BUG(); | 2330 | BUG(); |
2325 | } | 2331 | } |
2326 | 2332 | ||
2327 | l = strlen(policy_types[mode]); | 2333 | l = strlen(policy_modes[mode]); |
2328 | if (buffer + maxlen < p + l + 1) | 2334 | if (buffer + maxlen < p + l + 1) |
2329 | return -ENOSPC; | 2335 | return -ENOSPC; |
2330 | 2336 | ||
2331 | strcpy(p, policy_types[mode]); | 2337 | strcpy(p, policy_modes[mode]); |
2332 | p += l; | 2338 | p += l; |
2333 | 2339 | ||
2334 | if (flags & MPOL_MODE_FLAGS) { | 2340 | if (flags & MPOL_MODE_FLAGS) { |