parisc: Add huge page support for parisc
Helge Deller
maintainerRFC PATCH 1/1 parisc: Add huge page support for parisc
This is an initial working version of getting huge pages support on parisc.
Can be pulled from my "hugetlb_hppa3" branch of my git tree as well:
http://git.kernel.org/cgit/linux/kernel/git/deller/parisc-linux.git/log/?h=hugetlb_hppa3
Signed-off-by Helge Deller <[email protected]>
arch/parisc/Kconfig +3 -0
@@ -108,6 +108,9 @@ config PGTABLE_LEVELS default 3 if 64BIT && PARISC_PAGE_SIZE_4KB default 2 +config SYS_SUPPORTS_HUGETLBFS + def_bool y if 64BIT + source "init/Kconfig" source "kernel/Kconfig.freezer"
arch/parisc/include/asm/hugetlb.h new file +85 -0
85 lines not on this page · raw message
arch/parisc/include/asm/page.h +4 -1
@@ -145,10 +145,13 @@ extern int npmem_ranges;#endif /* CONFIG_DISCONTIGMEM */ #ifdef CONFIG_HUGETLB_PAGE -#define HPAGE_SHIFT 22/* 4MB (is this fixed?) */ +#define HPAGE_SHIFT PMD_SHIFT/* fixed for transparent huge pages */ #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)#define HPAGE_MASK (~(HPAGE_SIZE - 1))#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) + +#define REAL_HPAGE_SHIFT 20/* 20=1MB, 22=4MB */ +#define _HUGE_PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_1M#endif #define virt_addr_valid (kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
arch/parisc/include/asm/pgtable.h +14 -3
@@ -167,7 +167,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)#define _PAGE_NO_CACHE_BIT 24/* (0x080) Uncached Page (U bit) */ #define _PAGE_ACCESSED_BIT 23/* (0x100) Software: Page Accessed */ #define _PAGE_PRESENT_BIT 22/* (0x200) Software: translation valid */ -/* bit 21 was formerly the FLUSH bit but is now unused */ +#define _PAGE_HPAGE_BIT 21/* (0x400) Huge Page */ #define _PAGE_USER_BIT 20/* (0x800) Software: User accessible page */ /* N.B. The bits are defined in terms of a 32 bit word above, so the */
@@ -194,6 +194,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)#define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT))#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT)) +#define _PAGE_HUGE (1 << xlate_pabit(_PAGE_HPAGE_BIT))#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)
@@ -217,7 +218,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)#define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT))#define PxD_FLAG_MASK (0xf)#define PxD_FLAG_SHIFT (4) -#define PxD_VALUE_SHIFT (8)/* (PAGE_SHIFT-PxD_FLAG_SHIFT) */ +#define PxD_VALUE_SHIFT (PFN_PTE_SHIFT-PxD_FLAG_SHIFT)#ifndef __ASSEMBLY__
@@ -363,6 +364,13 @@ static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; returnstatic inline pte_t pte_mkspecial (pte_t pte) {return pte; }/* +* Huge pte definitions. +*/ +#define pte_huge (pte) (pte_val(pte) & _PAGE_HUGE) +#define pte_mkhuge (pte) (__pte(pte_val(pte) | _PAGE_HUGE)) + + +/* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */
@@ -410,8 +418,9 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)/* Find an entry in the second-level page table.. */ #if CONFIG_PGTABLE_LEVELS ==3 +#define pmd_index (addr) (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))#define pmd_offset (dir,address) \ -((pmd_t *) pgd_page_vaddr(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1))) +((pmd_t *) pgd_page_vaddr(*(dir)) + pmd_index(address))#else #define pmd_offset (dir,addr) ((pmd_t *) dir)#endif
@@ -504,6 +513,8 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,#define _PAGE_SIZE_ENCODING_4M 5#define _PAGE_SIZE_ENCODING_16M 6#define _PAGE_SIZE_ENCODING_64M 7 +#define _PAGE_SIZE_ENCODING_MASK 0x0f +#define PHYS_PAGE_SIZE_ENCODING (x) ((x) & _PAGE_SIZE_ENCODING_MASK)#if defined(CONFIG_PARISC_PAGE_SIZE_4KB )# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4K
arch/parisc/include/uapi/asm/mman.h +6 -16
@@ -46,25 +46,15 @@#define MADV_DONTFORK 10/* don't inherit across fork */ #define MADV_DOFORK 11/* do inherit across fork */ -/* The range 12-64 is reserved for page size specification. */ -#define MADV_4K_PAGES 12/* Use 4K pages */ -#define MADV_16K_PAGES 14/* Use 16K pages */ -#define MADV_64K_PAGES 16/* Use 64K pages */ -#define MADV_256K_PAGES 18/* Use 256K pages */ -#define MADV_1M_PAGES 20/* Use 1 Megabyte pages */ -#define MADV_4M_PAGES 22/* Use 4 Megabyte pages */ -#define MADV_16M_PAGES 24/* Use 16 Megabyte pages */ -#define MADV_64M_PAGES 26/* Use 64 Megabyte pages */ +#define MADV_MERGEABLE 12/* KSM may merge identical pages */ +#define MADV_UNMERGEABLE 13/* KSM may not merge identical pages */ -#define MADV_MERGEABLE 65/* KSM may merge identical pages */ -#define MADV_UNMERGEABLE 66/* KSM may not merge identical pages */ +#define MADV_HUGEPAGE 14/* Worth backing with hugepages */ +#define MADV_NOHUGEPAGE 15/* Not worth backing with hugepages */ -#define MADV_HUGEPAGE 67/* Worth backing with hugepages */ -#define MADV_NOHUGEPAGE 68/* Not worth backing with hugepages */ - -#define MADV_DONTDUMP 69/* Explicity exclude from the core dump, +#define MADV_DONTDUMP 16/* Explicity exclude from the core dump, overrides the coredump filter bits */ -#define MADV_DODUMP 70/* Clear the MADV_NODUMP flag */ +#define MADV_DODUMP 17/* Clear the MADV_NODUMP flag */ /* compatibility flags */ #define MAP_FILE 0
arch/parisc/kernel/entry.S +27 -14
123 lines not on this page · raw message
arch/parisc/mm/Makefile +1 -0
@@ -3,3 +3,4 @@ # obj-y := init.o fault.o ioremap.o +obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
arch/parisc/mm/hugetlbpage.c new file +160 -0
160 lines not on this page · raw message