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