aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@engr.sgi.com>2005-10-29 21:17:00 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 00:40:45 -0400
commit5fcbb23050936d69de8087d4b311eaf55cb42740 (patch)
tree10d14ca6927bc1bfa4bca4d206d2e1039f6cbf03
parent8bccd85ffbaf8ff1448d1235fa6594e207695531 (diff)
[PATCH] Remove policy contextualization from mbind
Policy contextualization is only useful for task based policies and not for vma based policies. It may be useful to define allowed nodes that are not accessible from this thread because other threads may have access to these nodes. Without this patch strange memory policy situations may cause an application to fail with out of memory. Example: Let's say we have two threads A and B that share the same address space and a huge array computational array X. Thread A is restricted by its cpuset to nodes 0 and 1 and thread B is restricted by its cpuset to nodes 2 and 3. Thread A now wants to restrict allocations to the first node and thus applies a BIND policy on X to node 0 and 2. The cpuset limits this to node 0. Thus pages for X must be allocated on node 0 now. Thread B now touches a page that has never been used in X and faults in a page. According to the BIND policy of the vma for X the page must be allocated on page 0. However, the cpuset of B does not allow allocation on 0 and 1. Now the application fails in alloc_pages with out of memory. Signed-off-by: Christoph Lameter <clameter@sgi.com> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/mempolicy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 123925f50f86..2076b1542b8a 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -370,7 +370,7 @@ long do_mbind(unsigned long start, unsigned long len,
370 return -EINVAL; 370 return -EINVAL;
371 if (end == start) 371 if (end == start)
372 return 0; 372 return 0;
373 if (contextualize_policy(mode, nmask)) 373 if (mpol_check_policy(mode, nmask))
374 return -EINVAL; 374 return -EINVAL;
375 new = mpol_new(mode, nmask); 375 new = mpol_new(mode, nmask);
376 if (IS_ERR(new)) 376 if (IS_ERR(new))