This patch set adds hugetlbfs support to the MIPS architecture.
Huge pages are implemented by placing the PTE for the huge page
(flagged by the _PAGE_HUGE) in the PMD. This gives a huge page size
of 2M (PTRS_PER_PTE * PAGE_SIZE) when the PAGE_SIZE is 4K. Each huge
page occupies a complete TLB entry with the first half of the page
covered by entrylo0 and the second half by entrylo1. Since there is
only a single PTE for the huge page in the PMD, the value of entrylo1
is derived from entrylo0 by adding a constant of half a huge page. We
do this for several reasons:
1) The valid values of PageMask are such that this combination is
2) Since the PageMask applies to both entrylo0 *and* entrylo1 we
cannot leave one of them empty because the current vma allocation
mechanisms don't handle excluding areas that would fall in any gaps
caused by an empty entrylo from allocation to normal sized pages.
When hugetlbfs is enabled, there is an approximately two instruction
overhead in the normal path of the TLB refill handler. This is needed
to check the _PAGE_HUGE bit of each PMD entry. With hugetlbfs
disabled, there is no change.
Currently the patch only works for 64-bit kernels because the value of
PTRS_PER_PTE in 32-bit kernels is such that it is impossible to have a
valid PageMask. It is thought that by adjusting the page allocation
scheme, 32-bit kernels could be supported in the future.
All of the patches except the forth touch only the arch/mips tree.
The forth patch is the generic Kconfig change to allow MIPS to turn on
I will reply with the five patches.
David Daney (5):
MIPS: Add support files for hugeTLBfs.
MIPS: Add hugeTLBfs page defines.
MIPS: TLB support for hugeTLBfs.
Enable hugetlbfs for more systems.
MIPS: Add SYS_SUPPORTS_HUGETLBFS Kconfig variable and enable it for
arch/mips/Kconfig | 11 +++
arch/mips/include/asm/hugetlb.h | 114 +++++++++++++++++++++++
arch/mips/include/asm/mipsregs.h | 16 ++++
arch/mips/include/asm/page.h | 5 +
arch/mips/include/asm/pgtable-bits.h | 1 +
arch/mips/include/asm/pgtable.h | 10 ++
arch/mips/mm/Makefile | 1 +
arch/mips/mm/hugetlbpage.c | 101 +++++++++++++++++++++
arch/mips/mm/tlb-r4k.c | 43 +++++++---
arch/mips/mm/tlbex.c | 165
fs/Kconfig | 2 +-
11 files changed, 456 insertions(+), 13 deletions(-)
create mode 100644 arch/mips/include/asm/hugetlb.h
create mode 100644 arch/mips/mm/hugetlbpage.c