aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mempolicy.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-04-11 17:53:53 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-11 17:53:53 -0400
commit871039f02f8ec4ab2e5e9010718caa8e085786f1 (patch)
treef0d2b3127fc48c862967d68c46c2d46668137515 /mm/mempolicy.c
parente4077e018b5ead3de9951fc01d8bf12eeeeeefed (diff)
parent4a1032faac94ebbf647460ae3e06fc21146eb280 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/stmmac/stmmac_main.c drivers/net/wireless/wl12xx/wl1271_cmd.c drivers/net/wireless/wl12xx/wl1271_main.c drivers/net/wireless/wl12xx/wl1271_spi.c net/core/ethtool.c net/mac80211/scan.c
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r--mm/mempolicy.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 643f66e10187..08f40a2f3fe0 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -73,7 +73,6 @@
73#include <linux/sched.h> 73#include <linux/sched.h>
74#include <linux/nodemask.h> 74#include <linux/nodemask.h>
75#include <linux/cpuset.h> 75#include <linux/cpuset.h>
76#include <linux/gfp.h>
77#include <linux/slab.h> 76#include <linux/slab.h>
78#include <linux/string.h> 77#include <linux/string.h>
79#include <linux/module.h> 78#include <linux/module.h>
@@ -806,9 +805,13 @@ static long do_get_mempolicy(int *policy, nodemask_t *nmask,
806 805
807 err = 0; 806 err = 0;
808 if (nmask) { 807 if (nmask) {
809 task_lock(current); 808 if (mpol_store_user_nodemask(pol)) {
810 get_policy_nodemask(pol, nmask); 809 *nmask = pol->w.user_nodemask;
811 task_unlock(current); 810 } else {
811 task_lock(current);
812 get_policy_nodemask(pol, nmask);
813 task_unlock(current);
814 }
812 } 815 }
813 816
814 out: 817 out:
@@ -2195,8 +2198,8 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2195 char *rest = nodelist; 2198 char *rest = nodelist;
2196 while (isdigit(*rest)) 2199 while (isdigit(*rest))
2197 rest++; 2200 rest++;
2198 if (!*rest) 2201 if (*rest)
2199 err = 0; 2202 goto out;
2200 } 2203 }
2201 break; 2204 break;
2202 case MPOL_INTERLEAVE: 2205 case MPOL_INTERLEAVE:
@@ -2205,7 +2208,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2205 */ 2208 */
2206 if (!nodelist) 2209 if (!nodelist)
2207 nodes = node_states[N_HIGH_MEMORY]; 2210 nodes = node_states[N_HIGH_MEMORY];
2208 err = 0;
2209 break; 2211 break;
2210 case MPOL_LOCAL: 2212 case MPOL_LOCAL:
2211 /* 2213 /*
@@ -2215,11 +2217,19 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2215 goto out; 2217 goto out;
2216 mode = MPOL_PREFERRED; 2218 mode = MPOL_PREFERRED;
2217 break; 2219 break;
2218 2220 case MPOL_DEFAULT:
2219 /* 2221 /*
2220 * case MPOL_BIND: mpol_new() enforces non-empty nodemask. 2222 * Insist on a empty nodelist
2221 * case MPOL_DEFAULT: mpol_new() enforces empty nodemask, ignores flags. 2223 */
2222 */ 2224 if (!nodelist)
2225 err = 0;
2226 goto out;
2227 case MPOL_BIND:
2228 /*
2229 * Insist on a nodelist
2230 */
2231 if (!nodelist)
2232 goto out;
2223 } 2233 }
2224 2234
2225 mode_flags = 0; 2235 mode_flags = 0;
@@ -2233,13 +2243,14 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2233 else if (!strcmp(flags, "relative")) 2243 else if (!strcmp(flags, "relative"))
2234 mode_flags |= MPOL_F_RELATIVE_NODES; 2244 mode_flags |= MPOL_F_RELATIVE_NODES;
2235 else 2245 else
2236 err = 1; 2246 goto out;
2237 } 2247 }
2238 2248
2239 new = mpol_new(mode, mode_flags, &nodes); 2249 new = mpol_new(mode, mode_flags, &nodes);
2240 if (IS_ERR(new)) 2250 if (IS_ERR(new))
2241 err = 1; 2251 goto out;
2242 else { 2252
2253 {
2243 int ret; 2254 int ret;
2244 NODEMASK_SCRATCH(scratch); 2255 NODEMASK_SCRATCH(scratch);
2245 if (scratch) { 2256 if (scratch) {
@@ -2250,13 +2261,15 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2250 ret = -ENOMEM; 2261 ret = -ENOMEM;
2251 NODEMASK_SCRATCH_FREE(scratch); 2262 NODEMASK_SCRATCH_FREE(scratch);
2252 if (ret) { 2263 if (ret) {
2253 err = 1;
2254 mpol_put(new); 2264 mpol_put(new);
2255 } else if (no_context) { 2265 goto out;
2256 /* save for contextualization */
2257 new->w.user_nodemask = nodes;
2258 } 2266 }
2259 } 2267 }
2268 err = 0;
2269 if (no_context) {
2270 /* save for contextualization */
2271 new->w.user_nodemask = nodes;
2272 }
2260 2273
2261out: 2274out:
2262 /* Restore string for error message */ 2275 /* Restore string for error message */