Skip to content

Commit 859f7ef

Browse files
Zhihui Zhangtorvalds
Zhihui Zhang
authored andcommitted
mm/mempolicy.c: remove unnecessary is_valid_nodemask()
When nodes is true, nsc->mask2 has already been filtered by nsc->mask1, which has already factored in node_states[N_MEMORY]. Signed-off-by: Zhihui Zhang <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Oleg Nesterov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 44e8967 commit 859f7ef

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

mm/mempolicy.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ static const struct mempolicy_operations {
162162
enum mpol_rebind_step step);
163163
} mpol_ops[MPOL_MAX];
164164

165-
/* Check that the nodemask contains at least one populated zone */
166-
static int is_valid_nodemask(const nodemask_t *nodemask)
167-
{
168-
return nodes_intersects(*nodemask, node_states[N_MEMORY]);
169-
}
170-
171165
static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
172166
{
173167
return pol->flags & MPOL_MODE_FLAGS;
@@ -202,7 +196,7 @@ static int mpol_new_preferred(struct mempolicy *pol, const nodemask_t *nodes)
202196

203197
static int mpol_new_bind(struct mempolicy *pol, const nodemask_t *nodes)
204198
{
205-
if (!is_valid_nodemask(nodes))
199+
if (nodes_empty(*nodes))
206200
return -EINVAL;
207201
pol->v.nodes = *nodes;
208202
return 0;
@@ -234,7 +228,7 @@ static int mpol_set_nodemask(struct mempolicy *pol,
234228
nodes = NULL; /* explicit local allocation */
235229
else {
236230
if (pol->flags & MPOL_F_RELATIVE_NODES)
237-
mpol_relative_nodemask(&nsc->mask2, nodes,&nsc->mask1);
231+
mpol_relative_nodemask(&nsc->mask2, nodes, &nsc->mask1);
238232
else
239233
nodes_and(nsc->mask2, *nodes, nsc->mask1);
240234

0 commit comments

Comments
 (0)