~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/mm/hugetlbpage.c

Version: ~ [ linux-5.11 ] ~ [ linux-5.10.17 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.99 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.176 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.221 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.257 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.257 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * MIPS Huge TLB Page Support for Kernel.
  3  *
  4  * This file is subject to the terms and conditions of the GNU General Public
  5  * License.  See the file "COPYING" in the main directory of this archive
  6  * for more details.
  7  *
  8  * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
  9  * Copyright 2005, Embedded Alley Solutions, Inc.
 10  * Matt Porter <mporter@embeddedalley.com>
 11  * Copyright (C) 2008, 2009 Cavium Networks, Inc.
 12  */
 13 
 14 #include <linux/fs.h>
 15 #include <linux/mm.h>
 16 #include <linux/hugetlb.h>
 17 #include <linux/pagemap.h>
 18 #include <linux/err.h>
 19 #include <linux/sysctl.h>
 20 #include <asm/mman.h>
 21 #include <asm/tlb.h>
 22 #include <asm/tlbflush.h>
 23 
 24 pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr,
 25                       unsigned long sz)
 26 {
 27         pgd_t *pgd;
 28         pud_t *pud;
 29         pte_t *pte = NULL;
 30 
 31         pgd = pgd_offset(mm, addr);
 32         pud = pud_alloc(mm, pgd, addr);
 33         if (pud)
 34                 pte = (pte_t *)pmd_alloc(mm, pud, addr);
 35 
 36         return pte;
 37 }
 38 
 39 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 40 {
 41         pgd_t *pgd;
 42         pud_t *pud;
 43         pmd_t *pmd = NULL;
 44 
 45         pgd = pgd_offset(mm, addr);
 46         if (pgd_present(*pgd)) {
 47                 pud = pud_offset(pgd, addr);
 48                 if (pud_present(*pud))
 49                         pmd = pmd_offset(pud, addr);
 50         }
 51         return (pte_t *) pmd;
 52 }
 53 
 54 /*
 55  * This function checks for proper alignment of input addr and len parameters.
 56  */
 57 int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
 58 {
 59         if (len & ~HPAGE_MASK)
 60                 return -EINVAL;
 61         if (addr & ~HPAGE_MASK)
 62                 return -EINVAL;
 63         return 0;
 64 }
 65 
 66 int pmd_huge(pmd_t pmd)
 67 {
 68         return (pmd_val(pmd) & _PAGE_HUGE) != 0;
 69 }
 70 
 71 int pud_huge(pud_t pud)
 72 {
 73         return (pud_val(pud) & _PAGE_HUGE) != 0;
 74 }
 75 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp