pgalloc_64.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _SPARC64_PGALLOC_H
  2. #define _SPARC64_PGALLOC_H
  3. #include <linux/kernel.h>
  4. #include <linux/sched.h>
  5. #include <linux/mm.h>
  6. #include <linux/slab.h>
  7. #include <linux/quicklist.h>
  8. #include <asm/spitfire.h>
  9. #include <asm/cpudata.h>
  10. #include <asm/cacheflush.h>
  11. #include <asm/page.h>
  12. /* Page table allocation/freeing. */
  13. static inline pgd_t *pgd_alloc(struct mm_struct *mm)
  14. {
  15. return quicklist_alloc(0, GFP_KERNEL, NULL);
  16. }
  17. static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
  18. {
  19. quicklist_free(0, NULL, pgd);
  20. }
  21. #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
  22. static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
  23. {
  24. return quicklist_alloc(0, GFP_KERNEL, NULL);
  25. }
  26. static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
  27. {
  28. quicklist_free(0, NULL, pmd);
  29. }
  30. static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
  31. unsigned long address)
  32. {
  33. return quicklist_alloc(0, GFP_KERNEL, NULL);
  34. }
  35. static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
  36. unsigned long address)
  37. {
  38. struct page *page;
  39. void *pg;
  40. pg = quicklist_alloc(0, GFP_KERNEL, NULL);
  41. if (!pg)
  42. return NULL;
  43. page = virt_to_page(pg);
  44. pgtable_page_ctor(page);
  45. return page;
  46. }
  47. static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
  48. {
  49. quicklist_free(0, NULL, pte);
  50. }
  51. static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
  52. {
  53. pgtable_page_dtor(ptepage);
  54. quicklist_free_page(0, NULL, ptepage);
  55. }
  56. #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
  57. #define pmd_populate(MM,PMD,PTE_PAGE) \
  58. pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
  59. #define pmd_pgtable(pmd) pmd_page(pmd)
  60. static inline void check_pgt_cache(void)
  61. {
  62. quicklist_trim(0, NULL, 25, 16);
  63. }
  64. #endif /* _SPARC64_PGALLOC_H */