Index: linux-2.6.15-rc3-mm1/mm/mempolicy.c =================================================================== --- linux-2.6.15-rc3-mm1.orig/mm/mempolicy.c 2005-12-01 18:10:51.000000000 -0800 +++ linux-2.6.15-rc3-mm1/mm/mempolicy.c 2005-12-02 17:38:45.000000000 -0800 @@ -1693,6 +1693,41 @@ static inline int mpol_to_str(char *buff return p - buffer; } +/* + * Convert a representation of a memory policy from text + * form to binary. The function does not restrict + * the set of nodes to the ones allowed by a task. + * + * Returns either a memory policy or NULL for error. + */ +static struct mempolicy *str_to_mpol(char *buffer) +{ + nodemask_t nodes; + int mode; + int l; + + for (mode = 0; mode <= MPOL_MAX; mode++) { + l = strlen(policy_types[mode]); + if (strnicmp(policy_types[mode], buffer, l) == 0 + && (mode == MPOL_DEFAULT || buffer[l] == '=')) + break; + } + + if (mode > MPOL_MAX) + return NULL; + + if (mode == MPOL_DEFAULT) + return &default_policy; + + if (nodelist_parse(buffer + l + 1, nodes) || nodes_empty(nodes)) + return NULL; + + if (mpol_check_policy(mode, &nodes)) + return NULL; + + return mpol_new(mode, &nodes); +} + struct numa_maps { unsigned long pages; unsigned long anon;