Pull netlink into release branch
[linux-block.git] / include / asm-ia64 / pgalloc.h
CommitLineData
1da177e4
LT
1#ifndef _ASM_IA64_PGALLOC_H
2#define _ASM_IA64_PGALLOC_H
3
4/*
5 * This file contains the functions and defines necessary to allocate
6 * page tables.
7 *
8 * This hopefully works with any (fixed) ia-64 page-size, as defined
9 * in <asm/page.h> (currently 8192).
10 *
11 * Copyright (C) 1998-2001 Hewlett-Packard Co
12 * David Mosberger-Tang <davidm@hpl.hp.com>
13 * Copyright (C) 2000, Goutham Rao <goutham.rao@intel.com>
14 */
15
1da177e4
LT
16
17#include <linux/compiler.h>
18#include <linux/mm.h>
19#include <linux/page-flags.h>
20#include <linux/threads.h>
2bd62a40 21#include <linux/quicklist.h>
1da177e4
LT
22
23#include <asm/mmu_context.h>
24
fde740e4 25static inline pgd_t *pgd_alloc(struct mm_struct *mm)
1da177e4 26{
2bd62a40 27 return quicklist_alloc(0, GFP_KERNEL, NULL);
1da177e4
LT
28}
29
fde740e4 30static inline void pgd_free(pgd_t * pgd)
1da177e4 31{
2bd62a40 32 quicklist_free(0, NULL, pgd);
1da177e4
LT
33}
34
837cd0bd
RH
35#ifdef CONFIG_PGTABLE_4
36static inline void
37pgd_populate(struct mm_struct *mm, pgd_t * pgd_entry, pud_t * pud)
38{
39 pgd_val(*pgd_entry) = __pa(pud);
40}
41
42static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
43{
2bd62a40 44 return quicklist_alloc(0, GFP_KERNEL, NULL);
837cd0bd
RH
45}
46
47static inline void pud_free(pud_t * pud)
48{
2bd62a40 49 quicklist_free(0, NULL, pud);
837cd0bd
RH
50}
51#define __pud_free_tlb(tlb, pud) pud_free(pud)
52#endif /* CONFIG_PGTABLE_4 */
53
fde740e4
RH
54static inline void
55pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd)
1da177e4 56{
fde740e4
RH
57 pud_val(*pud_entry) = __pa(pmd);
58}
1da177e4 59
fde740e4
RH
60static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
61{
2bd62a40 62 return quicklist_alloc(0, GFP_KERNEL, NULL);
1da177e4
LT
63}
64
fde740e4 65static inline void pmd_free(pmd_t * pmd)
1da177e4 66{
2bd62a40 67 quicklist_free(0, NULL, pmd);
1da177e4
LT
68}
69
70#define __pmd_free_tlb(tlb, pmd) pmd_free(pmd)
71
72static inline void
fde740e4 73pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
1da177e4
LT
74{
75 pmd_val(*pmd_entry) = page_to_phys(pte);
76}
77
78static inline void
fde740e4 79pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmd_entry, pte_t * pte)
1da177e4
LT
80{
81 pmd_val(*pmd_entry) = __pa(pte);
82}
83
fde740e4
RH
84static inline struct page *pte_alloc_one(struct mm_struct *mm,
85 unsigned long addr)
1da177e4 86{
2bd62a40 87 void *pg = quicklist_alloc(0, GFP_KERNEL, NULL);
71120061 88 return pg ? virt_to_page(pg) : NULL;
1da177e4
LT
89}
90
fde740e4
RH
91static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
92 unsigned long addr)
1da177e4 93{
2bd62a40 94 return quicklist_alloc(0, GFP_KERNEL, NULL);
1da177e4
LT
95}
96
fde740e4 97static inline void pte_free(struct page *pte)
1da177e4 98{
2bd62a40 99 quicklist_free_page(0, NULL, pte);
1da177e4
LT
100}
101
fde740e4 102static inline void pte_free_kernel(pte_t * pte)
1da177e4 103{
2bd62a40 104 quicklist_free(0, NULL, pte);
1da177e4
LT
105}
106
2bd62a40
CL
107static inline void check_pgt_cache(void)
108{
109 quicklist_trim(0, NULL, 25, 16);
110}
1da177e4 111
2bd62a40 112#define __pte_free_tlb(tlb, pte) pte_free(pte)
1da177e4 113
fde740e4 114#endif /* _ASM_IA64_PGALLOC_H */