diff options
author | Jianguo Wu <wujianguo@huawei.com> | 2013-09-11 17:21:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:57:29 -0400 |
commit | 1da6f0e1b316d0215989fe4d7c657edead1fdea7 (patch) | |
tree | 0fe575f5181927218f9f2e9bd3dca571ec18445f /mm/mempolicy.c | |
parent | af0ed73e699bb0453603b1d1a4727377641b2096 (diff) |
mm/mempolicy: return NULL if node is NUMA_NO_NODE in get_task_policy
If node == NUMA_NO_NODE, pol is NULL, we should return NULL instead of
do "if (!pol->mode)" check.
[akpm@linux-foundation.org: reorganise code]
Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 6b1d426731ae..27022ca890f8 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -123,16 +123,19 @@ static struct mempolicy preferred_node_policy[MAX_NUMNODES]; | |||
123 | static struct mempolicy *get_task_policy(struct task_struct *p) | 123 | static struct mempolicy *get_task_policy(struct task_struct *p) |
124 | { | 124 | { |
125 | struct mempolicy *pol = p->mempolicy; | 125 | struct mempolicy *pol = p->mempolicy; |
126 | int node; | ||
127 | 126 | ||
128 | if (!pol) { | 127 | if (!pol) { |
129 | node = numa_node_id(); | 128 | int node = numa_node_id(); |
130 | if (node != NUMA_NO_NODE) | ||
131 | pol = &preferred_node_policy[node]; | ||
132 | 129 | ||
133 | /* preferred_node_policy is not initialised early in boot */ | 130 | if (node != NUMA_NO_NODE) { |
134 | if (!pol->mode) | 131 | pol = &preferred_node_policy[node]; |
135 | pol = NULL; | 132 | /* |
133 | * preferred_node_policy is not initialised early in | ||
134 | * boot | ||
135 | */ | ||
136 | if (!pol->mode) | ||
137 | pol = NULL; | ||
138 | } | ||
136 | } | 139 | } |
137 | 140 | ||
138 | return pol; | 141 | return pol; |