mm: hugetlb: Copy general hugetlb code from x86 to mm.
authorSteve Capper <steve.capper@linaro.org>
Tue, 30 Apr 2013 07:02:03 +0000 (08:02 +0100)
committerMark Brown <broonie@linaro.org>
Fri, 9 May 2014 11:02:46 +0000 (12:02 +0100)
commitba47dd3ca215b7dbdd638bad985db555997506a5
tree9bceed62c1c2fff286ef6f816df35d1c6db6524a
parent4daa1bbe44332f96f55a9d79abdf9bee04da48b7
mm: hugetlb: Copy general hugetlb code from x86 to mm.

The huge_pte_alloc, huge_pte_offset and follow_huge_p[mu]d
functions in x86/mm/hugetlbpage.c do not rely on any architecture
specific knowledge other than the fact that pmds and puds can be
treated as huge ptes.

To allow other architectures to use this code (and reduce the need
for code duplication), this patch copies these functions into mm,
replaces the use of pud_large with pud_huge and provides a config
flag to activate them:
CONFIG_ARCH_WANT_GENERAL_HUGETLB

If CONFIG_ARCH_WANT_HUGE_PMD_SHARE is also active then the
huge_pmd_share code will be called by huge_pte_alloc (othewise we
call pmd_alloc and skip the sharing code).

Signed-off-by: Steve Capper <steve.capper@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c