提交 5fcbb230 编写于 作者: C Christoph Lameter 提交者: Linus Torvalds

[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: NChristoph Lameter <clameter@sgi.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8bccd85f
...@@ -370,7 +370,7 @@ long do_mbind(unsigned long start, unsigned long len, ...@@ -370,7 +370,7 @@ long do_mbind(unsigned long start, unsigned long len,
return -EINVAL; return -EINVAL;
if (end == start) if (end == start)
return 0; return 0;
if (contextualize_policy(mode, nmask)) if (mpol_check_policy(mode, nmask))
return -EINVAL; return -EINVAL;
new = mpol_new(mode, nmask); new = mpol_new(mode, nmask);
if (IS_ERR(new)) if (IS_ERR(new))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册