diff options
-rw-r--r-- | mm/mempolicy.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index c0c5d388046f..656db97584f0 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -126,22 +126,20 @@ static struct mempolicy preferred_node_policy[MAX_NUMNODES]; | |||
126 | static struct mempolicy *get_task_policy(struct task_struct *p) | 126 | static struct mempolicy *get_task_policy(struct task_struct *p) |
127 | { | 127 | { |
128 | struct mempolicy *pol = p->mempolicy; | 128 | struct mempolicy *pol = p->mempolicy; |
129 | int node; | ||
129 | 130 | ||
130 | if (!pol) { | 131 | if (pol) |
131 | int node = numa_node_id(); | 132 | return pol; |
132 | 133 | ||
133 | if (node != NUMA_NO_NODE) { | 134 | node = numa_node_id(); |
134 | pol = &preferred_node_policy[node]; | 135 | if (node != NUMA_NO_NODE) { |
135 | /* | 136 | pol = &preferred_node_policy[node]; |
136 | * preferred_node_policy is not initialised early in | 137 | /* preferred_node_policy is not initialised early in boot */ |
137 | * boot | 138 | if (pol->mode) |
138 | */ | 139 | return pol; |
139 | if (!pol->mode) | ||
140 | pol = NULL; | ||
141 | } | ||
142 | } | 140 | } |
143 | 141 | ||
144 | return pol; | 142 | return &default_policy; |
145 | } | 143 | } |
146 | 144 | ||
147 | static const struct mempolicy_operations { | 145 | static const struct mempolicy_operations { |
@@ -1644,14 +1642,14 @@ struct mempolicy *get_vma_policy(struct task_struct *task, | |||
1644 | mpol_get(pol); | 1642 | mpol_get(pol); |
1645 | } | 1643 | } |
1646 | } | 1644 | } |
1647 | if (!pol) | 1645 | |
1648 | pol = &default_policy; | ||
1649 | return pol; | 1646 | return pol; |
1650 | } | 1647 | } |
1651 | 1648 | ||
1652 | bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma) | 1649 | bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma) |
1653 | { | 1650 | { |
1654 | struct mempolicy *pol = get_task_policy(task); | 1651 | struct mempolicy *pol = get_task_policy(task); |
1652 | |||
1655 | if (vma) { | 1653 | if (vma) { |
1656 | if (vma->vm_ops && vma->vm_ops->get_policy) { | 1654 | if (vma->vm_ops && vma->vm_ops->get_policy) { |
1657 | bool ret = false; | 1655 | bool ret = false; |
@@ -1667,9 +1665,6 @@ bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma) | |||
1667 | } | 1665 | } |
1668 | } | 1666 | } |
1669 | 1667 | ||
1670 | if (!pol) | ||
1671 | return default_policy.flags & MPOL_F_MOF; | ||
1672 | |||
1673 | return pol->flags & MPOL_F_MOF; | 1668 | return pol->flags & MPOL_F_MOF; |
1674 | } | 1669 | } |
1675 | 1670 | ||
@@ -2077,7 +2072,7 @@ struct page *alloc_pages_current(gfp_t gfp, unsigned order) | |||
2077 | struct page *page; | 2072 | struct page *page; |
2078 | unsigned int cpuset_mems_cookie; | 2073 | unsigned int cpuset_mems_cookie; |
2079 | 2074 | ||
2080 | if (!pol || in_interrupt() || (gfp & __GFP_THISNODE)) | 2075 | if (in_interrupt() || (gfp & __GFP_THISNODE)) |
2081 | pol = &default_policy; | 2076 | pol = &default_policy; |
2082 | 2077 | ||
2083 | retry_cpuset: | 2078 | retry_cpuset: |