mempolicy.c (3b9aadf7278d16d7bed4d5d808501065f70898d8) | mempolicy.c (dedf2c73b80b4566dfcae8ebe9ed46a38b63a1f9) |
---|---|
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 --- 2697 unchanged lines hidden (view full) --- 2706 * Format of input: 2707 * <mode>[=<flags>][:<nodelist>] 2708 * 2709 * On success, returns 0, else 1 2710 */ 2711int mpol_parse_str(char *str, struct mempolicy **mpol) 2712{ 2713 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 --- 2697 unchanged lines hidden (view full) --- 2706 * Format of input: 2707 * <mode>[=<flags>][:<nodelist>] 2708 * 2709 * On success, returns 0, else 1 2710 */ 2711int mpol_parse_str(char *str, struct mempolicy **mpol) 2712{ 2713 struct mempolicy *new = NULL; |
2714 unsigned short mode; | |
2715 unsigned short mode_flags; 2716 nodemask_t nodes; 2717 char *nodelist = strchr(str, ':'); 2718 char *flags = strchr(str, '='); | 2714 unsigned short mode_flags; 2715 nodemask_t nodes; 2716 char *nodelist = strchr(str, ':'); 2717 char *flags = strchr(str, '='); |
2719 int err = 1; | 2718 int err = 1, mode; |
2720 2721 if (nodelist) { 2722 /* NUL-terminate mode or flags string */ 2723 *nodelist++ = '\0'; 2724 if (nodelist_parse(nodelist, nodes)) 2725 goto out; 2726 if (!nodes_subset(nodes, node_states[N_MEMORY])) 2727 goto out; 2728 } else 2729 nodes_clear(nodes); 2730 2731 if (flags) 2732 *flags++ = '\0'; /* terminate mode string */ 2733 | 2719 2720 if (nodelist) { 2721 /* NUL-terminate mode or flags string */ 2722 *nodelist++ = '\0'; 2723 if (nodelist_parse(nodelist, nodes)) 2724 goto out; 2725 if (!nodes_subset(nodes, node_states[N_MEMORY])) 2726 goto out; 2727 } else 2728 nodes_clear(nodes); 2729 2730 if (flags) 2731 *flags++ = '\0'; /* terminate mode string */ 2732 |
2734 for (mode = 0; mode < MPOL_MAX; mode++) { 2735 if (!strcmp(str, policy_modes[mode])) { 2736 break; 2737 } 2738 } 2739 if (mode >= MPOL_MAX) | 2733 mode = match_string(policy_modes, MPOL_MAX, str); 2734 if (mode < 0) |
2740 goto out; 2741 2742 switch (mode) { 2743 case MPOL_PREFERRED: 2744 /* 2745 * Insist on a nodelist of one node only 2746 */ 2747 if (nodelist) { --- 145 unchanged lines hidden --- | 2735 goto out; 2736 2737 switch (mode) { 2738 case MPOL_PREFERRED: 2739 /* 2740 * Insist on a nodelist of one node only 2741 */ 2742 if (nodelist) { --- 145 unchanged lines hidden --- |