pgalloc.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* $Id: pgalloc.h,v 1.30 2001/12/21 04:56:17 davem Exp $ */
  2. #ifndef _SPARC64_PGALLOC_H
  3. #define _SPARC64_PGALLOC_H
  4. #include <linux/kernel.h>
  5. #include <linux/sched.h>
  6. #include <linux/mm.h>
  7. #include <linux/slab.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. extern kmem_cache_t *pgtable_cache;
  14. static inline pgd_t *pgd_alloc(struct mm_struct *mm)
  15. {
  16. return kmem_cache_alloc(pgtable_cache, GFP_KERNEL);
  17. }
  18. static inline void pgd_free(pgd_t *pgd)
  19. {
  20. kmem_cache_free(pgtable_cache, pgd);
  21. }
  22. #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
  23. static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
  24. {
  25. return kmem_cache_alloc(pgtable_cache,
  26. GFP_KERNEL|__GFP_REPEAT);
  27. }
  28. static inline void pmd_free(pmd_t *pmd)
  29. {
  30. kmem_cache_free(pgtable_cache, pmd);
  31. }
  32. static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
  33. unsigned long address)
  34. {
  35. return kmem_cache_alloc(pgtable_cache,
  36. GFP_KERNEL|__GFP_REPEAT);
  37. }
  38. static inline struct page *pte_alloc_one(struct mm_struct *mm,
  39. unsigned long address)
  40. {
  41. return virt_to_page(pte_alloc_one_kernel(mm, address));
  42. }
  43. static inline void pte_free_kernel(pte_t *pte)
  44. {
  45. kmem_cache_free(pgtable_cache, pte);
  46. }
  47. static inline void pte_free(struct page *ptepage)
  48. {
  49. pte_free_kernel(page_address(ptepage));
  50. }
  51. #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
  52. #define pmd_populate(MM,PMD,PTE_PAGE) \
  53. pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
  54. #define check_pgt_cache() do { } while (0)
  55. #endif /* _SPARC64_PGALLOC_H */