mempolicy.c (e17f74af351cce9a1bade7b33af179497fdf95cf) mempolicy.c (b4652e8429100ba5c3ddb49499faa1188c98c246)
1/*
2 * Simple NUMA memory policy for the Linux kernel.
3 *
4 * Copyright 2003,2004 Andi Kleen, SuSE Labs.
5 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc.
6 * Subject to the GNU Public License, version 2.
7 *
8 * NUMA policy allows the user to give hints in which node(s) memory should

--- 2134 unchanged lines hidden (view full) ---

2143 * specified, the input nodemask will already have been saved. Saving
2144 * it again is redundant, but safe.
2145 *
2146 * On success, returns 0, else 1
2147 */
2148int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2149{
2150 struct mempolicy *new = NULL;
1/*
2 * Simple NUMA memory policy for the Linux kernel.
3 *
4 * Copyright 2003,2004 Andi Kleen, SuSE Labs.
5 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc.
6 * Subject to the GNU Public License, version 2.
7 *
8 * NUMA policy allows the user to give hints in which node(s) memory should

--- 2134 unchanged lines hidden (view full) ---

2143 * specified, the input nodemask will already have been saved. Saving
2144 * it again is redundant, but safe.
2145 *
2146 * On success, returns 0, else 1
2147 */
2148int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2149{
2150 struct mempolicy *new = NULL;
2151 unsigned short uninitialized_var(mode);
2151 unsigned short mode;
2152 unsigned short uninitialized_var(mode_flags);
2153 nodemask_t nodes;
2154 char *nodelist = strchr(str, ':');
2155 char *flags = strchr(str, '=');
2152 unsigned short uninitialized_var(mode_flags);
2153 nodemask_t nodes;
2154 char *nodelist = strchr(str, ':');
2155 char *flags = strchr(str, '=');
2156 int i;
2157 int err = 1;
2158
2159 if (nodelist) {
2160 /* NUL-terminate mode or flags string */
2161 *nodelist++ = '\0';
2162 if (nodelist_parse(nodelist, nodes))
2163 goto out;
2164 if (!nodes_subset(nodes, node_states[N_HIGH_MEMORY]))
2165 goto out;
2166 } else
2167 nodes_clear(nodes);
2168
2169 if (flags)
2170 *flags++ = '\0'; /* terminate mode string */
2171
2156 int err = 1;
2157
2158 if (nodelist) {
2159 /* NUL-terminate mode or flags string */
2160 *nodelist++ = '\0';
2161 if (nodelist_parse(nodelist, nodes))
2162 goto out;
2163 if (!nodes_subset(nodes, node_states[N_HIGH_MEMORY]))
2164 goto out;
2165 } else
2166 nodes_clear(nodes);
2167
2168 if (flags)
2169 *flags++ = '\0'; /* terminate mode string */
2170
2172 for (i = 0; i <= MPOL_LOCAL; i++) {
2173 if (!strcmp(str, policy_types[i])) {
2174 mode = i;
2171 for (mode = 0; mode <= MPOL_LOCAL; mode++) {
2172 if (!strcmp(str, policy_types[mode])) {
2175 break;
2176 }
2177 }
2173 break;
2174 }
2175 }
2178 if (i > MPOL_LOCAL)
2176 if (mode > MPOL_LOCAL)
2179 goto out;
2180
2181 switch (mode) {
2182 case MPOL_PREFERRED:
2183 /*
2184 * Insist on a nodelist of one node only
2185 */
2186 if (nodelist) {

--- 327 unchanged lines hidden ---
2177 goto out;
2178
2179 switch (mode) {
2180 case MPOL_PREFERRED:
2181 /*
2182 * Insist on a nodelist of one node only
2183 */
2184 if (nodelist) {

--- 327 unchanged lines hidden ---