mm: use correct numa policy node for transparent hugepages
authorAndi Kleen <ak@linux.intel.com>
Sat, 5 Mar 2011 01:36:32 +0000 (17:36 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 5 Mar 2011 01:53:39 +0000 (17:53 -0800)
commit5c4b4be3b6b937256103a5ae49177e0c3a17cb8f
treef0b7a74e61af26576e48581b70b7bad0a82d0ee7
parent19ee151e140daa5183c4984981801e542e0544fb
mm: use correct numa policy node for transparent hugepages

Pass down the correct node for a transparent hugepage allocation.  Most
callers continue to use the current node, however the hugepaged daemon
now uses the previous node of the first to be collapsed page instead.
This ensures that khugepaged does not mess up local memory for an
existing process which uses local policy.

The choice of node is somewhat primitive currently: it just uses the
node of the first page in the pmd range.  An alternative would be to
look at multiple pages and use the most popular node.  I used the
simplest variant for now which should work well enough for the case of
all pages being on the same node.

[akpm@linux-foundation.org: coding-style fixes]
Acked-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/huge_memory.c
mm/mempolicy.c