diff options
-rw-r--r-- | mm/mempolicy.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index fea4a5da6e44..7b3ae977b158 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -645,11 +645,9 @@ static void get_policy_nodemask(struct mempolicy *p, nodemask_t *nodes) | |||
645 | *nodes = p->v.nodes; | 645 | *nodes = p->v.nodes; |
646 | break; | 646 | break; |
647 | case MPOL_PREFERRED: | 647 | case MPOL_PREFERRED: |
648 | /* or use current node instead of memory_map? */ | 648 | if (p->v.preferred_node >= 0) |
649 | if (p->v.preferred_node < 0) | ||
650 | *nodes = node_states[N_HIGH_MEMORY]; | ||
651 | else | ||
652 | node_set(p->v.preferred_node, *nodes); | 649 | node_set(p->v.preferred_node, *nodes); |
650 | /* else return empty node mask for local allocation */ | ||
653 | break; | 651 | break; |
654 | default: | 652 | default: |
655 | BUG(); | 653 | BUG(); |
@@ -804,7 +802,7 @@ int do_migrate_pages(struct mm_struct *mm, | |||
804 | int err = 0; | 802 | int err = 0; |
805 | nodemask_t tmp; | 803 | nodemask_t tmp; |
806 | 804 | ||
807 | down_read(&mm->mmap_sem); | 805 | down_read(&mm->mmap_sem); |
808 | 806 | ||
809 | err = migrate_vmas(mm, from_nodes, to_nodes, flags); | 807 | err = migrate_vmas(mm, from_nodes, to_nodes, flags); |
810 | if (err) | 808 | if (err) |
@@ -1948,10 +1946,12 @@ void numa_default_policy(void) | |||
1948 | } | 1946 | } |
1949 | 1947 | ||
1950 | /* | 1948 | /* |
1951 | * Display pages allocated per node and memory policy via /proc. | 1949 | * "local" is pseudo-policy: MPOL_PREFERRED with preferred_node == -1 |
1950 | * Used only for mpol_to_str() | ||
1952 | */ | 1951 | */ |
1952 | #define MPOL_LOCAL (MPOL_INTERLEAVE + 1) | ||
1953 | static const char * const policy_types[] = | 1953 | static const char * const policy_types[] = |
1954 | { "default", "prefer", "bind", "interleave" }; | 1954 | { "default", "prefer", "bind", "interleave", "local" }; |
1955 | 1955 | ||
1956 | /* | 1956 | /* |
1957 | * Convert a mempolicy into a string. | 1957 | * Convert a mempolicy into a string. |
@@ -1962,6 +1962,7 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) | |||
1962 | { | 1962 | { |
1963 | char *p = buffer; | 1963 | char *p = buffer; |
1964 | int l; | 1964 | int l; |
1965 | int nid; | ||
1965 | nodemask_t nodes; | 1966 | nodemask_t nodes; |
1966 | unsigned short mode; | 1967 | unsigned short mode; |
1967 | unsigned short flags = pol ? pol->flags : 0; | 1968 | unsigned short flags = pol ? pol->flags : 0; |
@@ -1978,7 +1979,11 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) | |||
1978 | 1979 | ||
1979 | case MPOL_PREFERRED: | 1980 | case MPOL_PREFERRED: |
1980 | nodes_clear(nodes); | 1981 | nodes_clear(nodes); |
1981 | node_set(pol->v.preferred_node, nodes); | 1982 | nid = pol->v.preferred_node; |
1983 | if (nid < 0) | ||
1984 | mode = MPOL_LOCAL; /* pseudo-policy */ | ||
1985 | else | ||
1986 | node_set(nid, nodes); | ||
1982 | break; | 1987 | break; |
1983 | 1988 | ||
1984 | case MPOL_BIND: | 1989 | case MPOL_BIND: |
@@ -1993,8 +1998,8 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) | |||
1993 | } | 1998 | } |
1994 | 1999 | ||
1995 | l = strlen(policy_types[mode]); | 2000 | l = strlen(policy_types[mode]); |
1996 | if (buffer + maxlen < p + l + 1) | 2001 | if (buffer + maxlen < p + l + 1) |
1997 | return -ENOSPC; | 2002 | return -ENOSPC; |
1998 | 2003 | ||
1999 | strcpy(p, policy_types[mode]); | 2004 | strcpy(p, policy_types[mode]); |
2000 | p += l; | 2005 | p += l; |
@@ -2093,6 +2098,9 @@ static inline void check_huge_range(struct vm_area_struct *vma, | |||
2093 | } | 2098 | } |
2094 | #endif | 2099 | #endif |
2095 | 2100 | ||
2101 | /* | ||
2102 | * Display pages allocated per node and memory policy via /proc. | ||
2103 | */ | ||
2096 | int show_numa_map(struct seq_file *m, void *v) | 2104 | int show_numa_map(struct seq_file *m, void *v) |
2097 | { | 2105 | { |
2098 | struct proc_maps_private *priv = m->private; | 2106 | struct proc_maps_private *priv = m->private; |