diff options
-rw-r--r-- | include/linux/cpuset.h | 5 | ||||
-rw-r--r-- | kernel/cpuset.c | 10 | ||||
-rw-r--r-- | mm/mempolicy.c | 5 |
3 files changed, 5 insertions, 15 deletions
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 6e2deef96b34..8b21786490ee 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -21,7 +21,8 @@ extern void cpuset_exit(struct task_struct *p); | |||
21 | extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p); | 21 | extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p); |
22 | void cpuset_init_current_mems_allowed(void); | 22 | void cpuset_init_current_mems_allowed(void); |
23 | void cpuset_update_current_mems_allowed(void); | 23 | void cpuset_update_current_mems_allowed(void); |
24 | void cpuset_restrict_to_mems_allowed(unsigned long *nodes); | 24 | #define cpuset_nodes_subset_current_mems_allowed(nodes) \ |
25 | nodes_subset((nodes), current->mems_allowed) | ||
25 | int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); | 26 | int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); |
26 | extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask); | 27 | extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask); |
27 | extern int cpuset_excl_nodes_overlap(const struct task_struct *p); | 28 | extern int cpuset_excl_nodes_overlap(const struct task_struct *p); |
@@ -42,7 +43,7 @@ static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p) | |||
42 | 43 | ||
43 | static inline void cpuset_init_current_mems_allowed(void) {} | 44 | static inline void cpuset_init_current_mems_allowed(void) {} |
44 | static inline void cpuset_update_current_mems_allowed(void) {} | 45 | static inline void cpuset_update_current_mems_allowed(void) {} |
45 | static inline void cpuset_restrict_to_mems_allowed(unsigned long *nodes) {} | 46 | #define cpuset_nodes_subset_current_mems_allowed(nodes) (1) |
46 | 47 | ||
47 | static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) | 48 | static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) |
48 | { | 49 | { |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index f63383e01ec7..6503c6da4c4f 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1750,16 +1750,6 @@ done: | |||
1750 | } | 1750 | } |
1751 | 1751 | ||
1752 | /** | 1752 | /** |
1753 | * cpuset_restrict_to_mems_allowed - limit nodes to current mems_allowed | ||
1754 | * @nodes: pointer to a node bitmap that is and-ed with mems_allowed | ||
1755 | */ | ||
1756 | void cpuset_restrict_to_mems_allowed(unsigned long *nodes) | ||
1757 | { | ||
1758 | bitmap_and(nodes, nodes, nodes_addr(current->mems_allowed), | ||
1759 | MAX_NUMNODES); | ||
1760 | } | ||
1761 | |||
1762 | /** | ||
1763 | * cpuset_zonelist_valid_mems_allowed - check zonelist vs. curremt mems_allowed | 1753 | * cpuset_zonelist_valid_mems_allowed - check zonelist vs. curremt mems_allowed |
1764 | * @zl: the zonelist to be checked | 1754 | * @zl: the zonelist to be checked |
1765 | * | 1755 | * |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 7051fe450e96..9dea2b8a7d48 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -387,10 +387,9 @@ static int contextualize_policy(int mode, nodemask_t *nodes) | |||
387 | if (!nodes) | 387 | if (!nodes) |
388 | return 0; | 388 | return 0; |
389 | 389 | ||
390 | /* Update current mems_allowed */ | ||
391 | cpuset_update_current_mems_allowed(); | 390 | cpuset_update_current_mems_allowed(); |
392 | /* Ignore nodes not set in current->mems_allowed */ | 391 | if (!cpuset_nodes_subset_current_mems_allowed(*nodes)) |
393 | cpuset_restrict_to_mems_allowed(nodes->bits); | 392 | return -EINVAL; |
394 | return mpol_check_policy(mode, nodes); | 393 | return mpol_check_policy(mode, nodes); |
395 | } | 394 | } |
396 | 395 | ||