1/*
2 *  linux/include/asm-arm/proc-armo/pgalloc.h
3 *
4 *  Copyright (C) 2001 Russell King
5 *
6 * Page table allocation/freeing primitives for 26-bit ARM processors.
7 */
8
9/* unfortunately, this includes linux/mm.h and the rest of the universe. */
10#include <linux/slab.h>
11
12extern kmem_cache_t *pte_cache;
13
14/*
15 * Allocate one PTE table.
16 *
17 * Note that we keep the processor copy of the PTE entries separate
18 * from the Linux copy.  The processor copies are offset by -PTRS_PER_PTE
19 * words from the Linux copy.
20 */
21static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address)
22{
23	return kmem_cache_alloc(pte_cache, GFP_KERNEL);
24}
25
26/*
27 * Free one PTE table.
28 */
29static inline void pte_free_slow(pte_t *pte)
30{
31	if (pte)
32		kmem_cache_free(pte_cache, pte);
33}
34
35/*
36 * Populate the pmdp entry with a pointer to the pte.  This pmd is part
37 * of the mm address space.
38 *
39 * If 'mm' is the init tasks mm, then we are doing a vmalloc, and we
40 * need to set stuff up correctly for it.
41 */
42#define pmd_populate(mm,pmdp,pte)				\
43	do {							\
44		set_pmd(pmdp, __mk_pmd(pte, _PAGE_TABLE));	\
45	} while (0)
46
47
48