Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356527
b: refs/heads/master
c: d3eb157
h: refs/heads/master
i:
  356525: 585d933
  356523: 8f220b3
  356519: 257083a
  356511: 85254c7
v: v3
  • Loading branch information
Lai Jiangshan authored and Linus Torvalds committed Feb 24, 2013
1 parent e04a62c commit c3e046d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a356ce38e134b3b09b439e88dc770f8f5567648
refs/heads/master: d3eb1570a9221b1b3ea8f6f460a9674c1bb761f1
36 changes: 22 additions & 14 deletions trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,7 @@ static const struct mempolicy_operations {
/* Check that the nodemask contains at least one populated zone */
static int is_valid_nodemask(const nodemask_t *nodemask)
{
int nd, k;

for_each_node_mask(nd, *nodemask) {
struct zone *z;

for (k = 0; k <= policy_zone; k++) {
z = &NODE_DATA(nd)->node_zones[k];
if (z->present_pages > 0)
return 1;
}
}

return 0;
return nodes_intersects(*nodemask, node_states[N_MEMORY]);
}

static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
Expand Down Expand Up @@ -1644,6 +1632,26 @@ struct mempolicy *get_vma_policy(struct task_struct *task,
return pol;
}

static int apply_policy_zone(struct mempolicy *policy, enum zone_type zone)
{
enum zone_type dynamic_policy_zone = policy_zone;

BUG_ON(dynamic_policy_zone == ZONE_MOVABLE);

/*
* if policy->v.nodes has movable memory only,
* we apply policy when gfp_zone(gfp) = ZONE_MOVABLE only.
*
* policy->v.nodes is intersect with node_states[N_MEMORY].
* so if the following test faile, it implies
* policy->v.nodes has movable memory only.
*/
if (!nodes_intersects(policy->v.nodes, node_states[N_HIGH_MEMORY]))
dynamic_policy_zone = ZONE_MOVABLE;

return zone >= dynamic_policy_zone;
}

/*
* Return a nodemask representing a mempolicy for filtering nodes for
* page allocation
Expand All @@ -1652,7 +1660,7 @@ static nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *policy)
{
/* Lower zones don't get a nodemask applied for MPOL_BIND */
if (unlikely(policy->mode == MPOL_BIND) &&
gfp_zone(gfp) >= policy_zone &&
apply_policy_zone(policy, gfp_zone(gfp)) &&
cpuset_nodemask_valid_mems_allowed(&policy->v.nodes))
return &policy->v.nodes;

Expand Down

0 comments on commit c3e046d

Please sign in to comment.