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

TOMOYO Linux Cross Reference
Linux/arch/avr32/include/asm/pgalloc.h

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  * Copyright (C) 2004-2006 Atmel Corporation
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License version 2 as
  6  * published by the Free Software Foundation.
  7  */
  8 #ifndef __ASM_AVR32_PGALLOC_H
  9 #define __ASM_AVR32_PGALLOC_H
 10 
 11 #include <linux/mm.h>
 12 #include <linux/quicklist.h>
 13 #include <asm/page.h>
 14 #include <asm/pgtable.h>
 15 
 16 #define QUICK_PGD       0       /* Preserve kernel mappings over free */
 17 #define QUICK_PT        1       /* Zero on free */
 18 
 19 static inline void pmd_populate_kernel(struct mm_struct *mm,
 20                                        pmd_t *pmd, pte_t *pte)
 21 {
 22         set_pmd(pmd, __pmd((unsigned long)pte));
 23 }
 24 
 25 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
 26                                     pgtable_t pte)
 27 {
 28         set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
 29 }
 30 #define pmd_pgtable(pmd) pmd_page(pmd)
 31 
 32 static inline void pgd_ctor(void *x)
 33 {
 34         pgd_t *pgd = x;
 35 
 36         memcpy(pgd + USER_PTRS_PER_PGD,
 37                 swapper_pg_dir + USER_PTRS_PER_PGD,
 38                 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
 39 }
 40 
 41 /*
 42  * Allocate and free page tables
 43  */
 44 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 45 {
 46         return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor);
 47 }
 48 
 49 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 50 {
 51         quicklist_free(QUICK_PGD, NULL, pgd);
 52 }
 53 
 54 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 55                                           unsigned long address)
 56 {
 57         return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
 58 }
 59 
 60 static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
 61                                          unsigned long address)
 62 {
 63         struct page *page;
 64         void *pg;
 65 
 66         pg = quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
 67         if (!pg)
 68                 return NULL;
 69 
 70         page = virt_to_page(pg);
 71         if (!pgtable_page_ctor(page)) {
 72                 quicklist_free(QUICK_PT, NULL, pg);
 73                 return NULL;
 74         }
 75 
 76         return page;
 77 }
 78 
 79 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
 80 {
 81         quicklist_free(QUICK_PT, NULL, pte);
 82 }
 83 
 84 static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
 85 {
 86         pgtable_page_dtor(pte);
 87         quicklist_free_page(QUICK_PT, NULL, pte);
 88 }
 89 
 90 #define __pte_free_tlb(tlb,pte,addr)                    \
 91 do {                                                    \
 92         pgtable_page_dtor(pte);                         \
 93         tlb_remove_page((tlb), pte);                    \
 94 } while (0)
 95 
 96 static inline void check_pgt_cache(void)
 97 {
 98         quicklist_trim(QUICK_PGD, NULL, 25, 16);
 99         quicklist_trim(QUICK_PT, NULL, 25, 16);
100 }
101 
102 #endif /* __ASM_AVR32_PGALLOC_H */
103 

~ [ 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