pgalloc.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 <linux/quicklist.h>
  9. #include <asm/spitfire.h>
  10. #include <asm/cpudata.h>
  11. #include <asm/cacheflush.h>
  12. #include <asm/page.h>
  13. /* Page table allocation/freeing. */
  14. static inline pgd_t *pgd_alloc(struct mm_struct *mm)
  15. {
  16. return quicklist_alloc(0, GFP_KERNEL, NULL);
  17. }
  18. static inline void pgd_free(pgd_t *pgd)
  19. {
  20. quicklist_free(0, NULL, 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 quicklist_alloc(0, GFP_KERNEL, NULL);
  26. }
  27. static inline void pmd_free(pmd_t *pmd)
  28. {
  29. quicklist_free(0, NULL, pmd);
  30. }
  31. static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
  32. unsigned long address)
  33. {
  34. return quicklist_alloc(0, GFP_KERNEL, NULL);
  35. }
  36. static inline struct page *pte_alloc_one(struct mm_struct *mm,
  37. unsigned long address)
  38. {
  39. void *pg = quicklist_alloc(0, GFP_KERNEL, NULL);
  40. return pg ? virt_to_page(pg) : NULL;
  41. }
  42. static inline void pte_free_kernel(pte_t *pte)
  43. {
  44. quicklist_free(0, NULL, pte);
  45. }
  46. static inline void pte_free(struct page *ptepage)
  47. {
  48. quicklist_free_page(0, NULL, ptepage);
  49. }
  50. #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
  51. #define pmd_populate(MM,PMD,PTE_PAGE) \
  52. pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
  53. static inline void check_pgt_cache(void)
  54. {
  55. quicklist_trim(0, NULL, 25, 16);
  56. }
  57. #endif /* _SPARC64_PGALLOC_H */