Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94043
b: refs/heads/master
c: 3f226aa
h: refs/heads/master
i:
  94041: 1fcfb74
  94039: 46da9c6
v: v3
  • Loading branch information
Lee Schermerhorn authored and Linus Torvalds committed Apr 28, 2008
1 parent d03cd9e commit c2a1219
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 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: 095f1fc4ebf36c64fddf9b6db29b1ab5517378e6
refs/heads/master: 3f226aa1cbc006f9d90f22084f519ad2a1286cd8
25 changes: 17 additions & 8 deletions trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ void numa_default_policy(void)

/*
* "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag
* Used only for mpol_to_str()
* Used only for mpol_parse_str() and mpol_to_str()
*/
#define MPOL_LOCAL (MPOL_INTERLEAVE + 1)
static const char * const policy_types[] =
Expand Down Expand Up @@ -1990,21 +1990,16 @@ int mpol_parse_str(char *str, unsigned short *mode, unsigned short *mode_flags,
if (flags)
*flags++ = '\0'; /* terminate mode string */

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

switch (*mode) {
case MPOL_DEFAULT:
/* Don't allow a nodelist nor flags */
if (!nodelist && !flags)
err = 0;
break;
case MPOL_PREFERRED:
/* Insist on a nodelist of one node only */
if (nodelist) {
Expand All @@ -2027,6 +2022,20 @@ int mpol_parse_str(char *str, unsigned short *mode, unsigned short *mode_flags,
if (!nodelist)
*policy_nodes = node_states[N_HIGH_MEMORY];
err = 0;
break;
default:
/*
* MPOL_DEFAULT or MPOL_LOCAL
* Don't allow a nodelist nor flags
*/
if (!nodelist && !flags)
err = 0;
if (*mode == MPOL_DEFAULT)
goto out;
/* else MPOL_LOCAL */
*mode = MPOL_PREFERRED;
nodes_clear(*policy_nodes);
break;
}

*mode_flags = 0;
Expand Down

0 comments on commit c2a1219

Please sign in to comment.