Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344787
b: refs/heads/master
c: 479e280
h: refs/heads/master
i:
  344785: c40af3a
  344783: 409cb0f
v: v3
  • Loading branch information
Peter Zijlstra authored and Mel Gorman committed Dec 11, 2012
1 parent 48bb4a6 commit a77259b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d10e63f29488b0f312a443f9507ea9b6fd3c9090
refs/heads/master: 479e2802d09f1e18a97262c4c6f8f17ae5884bd8
1 change: 1 addition & 0 deletions trunk/include/uapi/linux/mempolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum {
MPOL_PREFERRED,
MPOL_BIND,
MPOL_INTERLEAVE,
MPOL_LOCAL,
MPOL_MAX, /* always last member of enum */
};

Expand Down
9 changes: 6 additions & 3 deletions trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
(flags & MPOL_F_RELATIVE_NODES)))
return ERR_PTR(-EINVAL);
}
} else if (mode == MPOL_LOCAL) {
if (!nodes_empty(*nodes))
return ERR_PTR(-EINVAL);
mode = MPOL_PREFERRED;
} else if (nodes_empty(*nodes))
return ERR_PTR(-EINVAL);
policy = kmem_cache_alloc(policy_cache, GFP_KERNEL);
Expand Down Expand Up @@ -2399,7 +2403,6 @@ void numa_default_policy(void)
* "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag
* Used only for mpol_parse_str() and mpol_to_str()
*/
#define MPOL_LOCAL MPOL_MAX
static const char * const policy_modes[] =
{
[MPOL_DEFAULT] = "default",
Expand Down Expand Up @@ -2452,12 +2455,12 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
if (flags)
*flags++ = '\0'; /* terminate mode string */

for (mode = 0; mode <= MPOL_LOCAL; mode++) {
for (mode = 0; mode < MPOL_MAX; mode++) {
if (!strcmp(str, policy_modes[mode])) {
break;
}
}
if (mode > MPOL_LOCAL)
if (mode >= MPOL_MAX)
goto out;

switch (mode) {
Expand Down

0 comments on commit a77259b

Please sign in to comment.