Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 416685 | Differences between
and this patch

Collapse All | Expand All

(-)a/arch/alpha/include/asm/pgalloc.h (-4 / +14 lines)
Lines 38-47 pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
38
}
38
}
39
39
40
static inline pmd_t *
40
static inline pmd_t *
41
__pmd_alloc_one(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
42
{
43
	return (pmd_t *)__get_free_page(gfp_mask | __GFP_ZERO);
44
}
45
46
static inline pmd_t *
41
pmd_alloc_one(struct mm_struct *mm, unsigned long address)
47
pmd_alloc_one(struct mm_struct *mm, unsigned long address)
42
{
48
{
43
	pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
49
	return __pmd_alloc_one(mm, address, GFP_KERNEL | __GFP_REPEAT);
44
	return ret;
45
}
50
}
46
51
47
static inline void
52
static inline void
Lines 51-60 pmd_free(struct mm_struct *mm, pmd_t *pmd) Link Here
51
}
56
}
52
57
53
static inline pte_t *
58
static inline pte_t *
59
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addressi, gfp_t gfp_mask)
60
{
61
	return (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
62
}
63
64
static inline pte_t *
54
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
65
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
55
{
66
{
56
	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
67
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
57
	return pte;
58
}
68
}
59
69
60
static inline void
70
static inline void
(-)a/arch/arm/include/asm/pgalloc.h (-2 / +9 lines)
Lines 28-33 Link Here
28
/*
28
/*
29
 * Since we have only two-level page tables, these are trivial
29
 * Since we have only two-level page tables, these are trivial
30
 */
30
 */
31
#define __pmd_alloc_one(mm,addr,mask)	({ BUG(); ((pmd_t *)2); })
31
#define pmd_alloc_one(mm,addr)		({ BUG(); ((pmd_t *)2); })
32
#define pmd_alloc_one(mm,addr)		({ BUG(); ((pmd_t *)2); })
32
#define pmd_free(mm, pmd)		do { } while (0)
33
#define pmd_free(mm, pmd)		do { } while (0)
33
#define pgd_populate(mm,pmd,pte)	BUG()
34
#define pgd_populate(mm,pmd,pte)	BUG()
Lines 59-75 static inline void clean_pte_table(pte_t *pte) Link Here
59
 *  +------------+
60
 *  +------------+
60
 */
61
 */
61
static inline pte_t *
62
static inline pte_t *
62
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
63
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
63
{
64
{
64
	pte_t *pte;
65
	pte_t *pte;
65
66
66
	pte = (pte_t *)__get_free_page(PGALLOC_GFP);
67
	pte = (pte_t *)__get_free_page(gfp_mask | __GFP_NOTRACK | __GFP_ZERO);
67
	if (pte)
68
	if (pte)
68
		clean_pte_table(pte);
69
		clean_pte_table(pte);
69
70
70
	return pte;
71
	return pte;
71
}
72
}
72
73
74
static inline pte_t *
75
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
76
{
77
	return __pte_alloc_one_kernel(mm, addr, GFP_KERNEL | __GFP_REPEAT);
78
}
79
73
static inline pgtable_t
80
static inline pgtable_t
74
pte_alloc_one(struct mm_struct *mm, unsigned long addr)
81
pte_alloc_one(struct mm_struct *mm, unsigned long addr)
75
{
82
{
(-)a/arch/avr32/include/asm/pgalloc.h (-1 / +7 lines)
Lines 51-60 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
51
	quicklist_free(QUICK_PGD, NULL, pgd);
51
	quicklist_free(QUICK_PGD, NULL, pgd);
52
}
52
}
53
53
54
static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm,
55
					  unsigned long address, gfp_t gfp_mask)
56
{
57
	return quicklist_alloc(QUICK_PT, gfp_mask, NULL);
58
}
59
54
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
60
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
55
					  unsigned long address)
61
					  unsigned long address)
56
{
62
{
57
	return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
63
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
58
}
64
}
59
65
60
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
66
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
(-)a/arch/cris/include/asm/pgalloc.h (-2 / +8 lines)
Lines 22-31 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
22
	free_page((unsigned long)pgd);
22
	free_page((unsigned long)pgd);
23
}
23
}
24
24
25
static inline pte_t *
26
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
27
	gfp_t gfp_mask)
28
{
29
  	return (pte_t *) __get_free_page(gfp_mask | __GFP_ZERO);
30
}
31
25
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
32
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
26
{
33
{
27
  	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
34
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
28
 	return pte;
29
}
35
}
30
36
31
static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
37
static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
(-)a/arch/frv/include/asm/pgalloc.h (+3 lines)
Lines 35-42 extern pgd_t *pgd_alloc(struct mm_struct *); Link Here
35
extern void pgd_free(struct mm_struct *mm, pgd_t *);
35
extern void pgd_free(struct mm_struct *mm, pgd_t *);
36
36
37
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
37
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
38
extern pte_t *__pte_alloc_one_kernel(struct mm_struct *, unsigned long, gfp_t);
38
39
39
extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
40
extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
41
extern pgtable_t __pte_alloc_one(struct mm_struct *, unsigned long, gfp_t);
40
42
41
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
43
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
42
{
44
{
Lines 60-65 do { \ Link Here
60
 * inside the pgd, so has no extra memory associated with it.
62
 * inside the pgd, so has no extra memory associated with it.
61
 * (In the PAE case we free the pmds as part of the pgd.)
63
 * (In the PAE case we free the pmds as part of the pgd.)
62
 */
64
 */
65
#define __pmd_alloc_one(mm, addr,mask)		({ BUG(); ((pmd_t *) 2); })
63
#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *) 2); })
66
#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *) 2); })
64
#define pmd_free(mm, x)			do { } while (0)
67
#define pmd_free(mm, x)			do { } while (0)
65
#define __pmd_free_tlb(tlb,x,a)		do { } while (0)
68
#define __pmd_free_tlb(tlb,x,a)		do { } while (0)
(-)a/arch/frv/include/asm/pgtable.h (+1 lines)
Lines 223-228 static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address) Link Here
223
 * allocating and freeing a pud is trivial: the 1-entry pud is
223
 * allocating and freeing a pud is trivial: the 1-entry pud is
224
 * inside the pgd, so has no extra memory associated with it.
224
 * inside the pgd, so has no extra memory associated with it.
225
 */
225
 */
226
#define __pud_alloc_one(mm, address, mask)		NULL
226
#define pud_alloc_one(mm, address)		NULL
227
#define pud_alloc_one(mm, address)		NULL
227
#define pud_free(mm, x)				do { } while (0)
228
#define pud_free(mm, x)				do { } while (0)
228
#define __pud_free_tlb(tlb, x, address)		do { } while (0)
229
#define __pud_free_tlb(tlb, x, address)		do { } while (0)
(-)a/arch/frv/mm/pgalloc.c (-2 / +7 lines)
Lines 20-33 Link Here
20
20
21
pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((aligned(PAGE_SIZE)));
21
pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((aligned(PAGE_SIZE)));
22
22
23
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
23
pte_t *__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
24
{
24
{
25
	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
25
	pte_t *pte = (pte_t *)__get_free_page(gfp_mask);
26
	if (pte)
26
	if (pte)
27
		clear_page(pte);
27
		clear_page(pte);
28
	return pte;
28
	return pte;
29
}
29
}
30
30
31
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
32
{
33
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
34
}
35
31
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
36
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
32
{
37
{
33
	struct page *page;
38
	struct page *page;
(-)a/arch/ia64/include/asm/pgalloc.h (-3 / +21 lines)
Lines 39-47 pgd_populate(struct mm_struct *mm, pgd_t * pgd_entry, pud_t * pud) Link Here
39
	pgd_val(*pgd_entry) = __pa(pud);
39
	pgd_val(*pgd_entry) = __pa(pud);
40
}
40
}
41
41
42
static inline pud_t *
43
__pud_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
44
{
45
	return quicklist_alloc(0, gfp_mask, NULL);
46
}
47
42
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
48
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
43
{
49
{
44
	return quicklist_alloc(0, GFP_KERNEL, NULL);
50
	return __pud_alloc_one(mm, addr, GFP_KERNEL);
45
}
51
}
46
52
47
static inline void pud_free(struct mm_struct *mm, pud_t *pud)
53
static inline void pud_free(struct mm_struct *mm, pud_t *pud)
Lines 57-65 pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd) Link Here
57
	pud_val(*pud_entry) = __pa(pmd);
63
	pud_val(*pud_entry) = __pa(pmd);
58
}
64
}
59
65
66
static inline pmd_t *
67
__pmd_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
68
{
69
	return quicklist_alloc(0, gfp_mask, NULL);
70
}
71
60
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
72
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
61
{
73
{
62
	return quicklist_alloc(0, GFP_KERNEL, NULL);
74
	return __pmd_alloc_one(mm, addr, GFP_KERNEL);
63
}
75
}
64
76
65
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
77
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
Lines 95-104 static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr) Link Here
95
	return page;
107
	return page;
96
}
108
}
97
109
110
static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm,
111
					  unsigned long addr, gfp_t gfp_mask)
112
{
113
	return quicklist_alloc(0, gfp_mask, NULL);
114
}
115
98
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
116
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
99
					  unsigned long addr)
117
					  unsigned long addr)
100
{
118
{
101
	return quicklist_alloc(0, GFP_KERNEL, NULL);
119
	return __pte_alloc_one_kernel(mm, addr, GFP_KERNEL);
102
}
120
}
103
121
104
static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
122
static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
(-)a/arch/m32r/include/asm/pgalloc.h (-3 / +8 lines)
Lines 30-41 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
30
	free_page((unsigned long)pgd);
30
	free_page((unsigned long)pgd);
31
}
31
}
32
32
33
static __inline__ pte_t *__pte_alloc_one_kernel(struct mm_struct *mm,
34
	unsigned long address, gfp_t gfp_mask)
35
{
36
	return (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
37
}
38
33
static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
39
static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
34
	unsigned long address)
40
	unsigned long address)
35
{
41
{
36
	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
42
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL);
37
38
	return pte;
39
}
43
}
40
44
41
static __inline__ pgtable_t pte_alloc_one(struct mm_struct *mm,
45
static __inline__ pgtable_t pte_alloc_one(struct mm_struct *mm,
Lines 66-71 static inline void pte_free(struct mm_struct *mm, pgtable_t pte) Link Here
66
 * (In the PAE case we free the pmds as part of the pgd.)
70
 * (In the PAE case we free the pmds as part of the pgd.)
67
 */
71
 */
68
72
73
#define __pmd_alloc_one(mm, addr,mask)		({ BUG(); ((pmd_t *)2); })
69
#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *)2); })
74
#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *)2); })
70
#define pmd_free(mm, x)			do { } while (0)
75
#define pmd_free(mm, x)			do { } while (0)
71
#define __pmd_free_tlb(tlb, x, addr)	do { } while (0)
76
#define __pmd_free_tlb(tlb, x, addr)	do { } while (0)
(-)a/arch/m68k/include/asm/motorola_pgalloc.h (-3 / +17 lines)
Lines 5-17 Link Here
5
#include <asm/tlbflush.h>
5
#include <asm/tlbflush.h>
6
6
7
extern pmd_t *get_pointer_table(void);
7
extern pmd_t *get_pointer_table(void);
8
extern pmd_t *__get_pointer_table (gfp_t);
8
extern int free_pointer_table(pmd_t *);
9
extern int free_pointer_table(pmd_t *);
9
10
10
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
11
static inline pte_t *
12
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
13
	gfp_t gfp_mask)
11
{
14
{
12
	pte_t *pte;
15
	pte_t *pte;
13
16
14
	pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
17
	pte = (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
15
	if (pte) {
18
	if (pte) {
16
		__flush_page_to_ram(pte);
19
		__flush_page_to_ram(pte);
17
		flush_tlb_kernel_page(pte);
20
		flush_tlb_kernel_page(pte);
Lines 21-26 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long ad Link Here
21
	return pte;
24
	return pte;
22
}
25
}
23
26
27
static inline pte_t *
28
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
29
{
30
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
31
}
32
24
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
33
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
25
{
34
{
26
	cache_page(pte);
35
	cache_page(pte);
Lines 61-70 static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page, Link Here
61
	__free_page(page);
70
	__free_page(page);
62
}
71
}
63
72
73
static inline pmd_t *
74
__pmd_alloc_one(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
75
{
76
	return __get_pointer_table(gfp_mask);
77
}
64
78
65
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
79
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
66
{
80
{
67
	return get_pointer_table();
81
	return __pmd_alloc_one(mm, address, GFP_KERNEL);
68
}
82
}
69
83
70
static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
84
static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
(-)a/arch/m68k/include/asm/sun3_pgalloc.h (-3 / +11 lines)
Lines 18-23 Link Here
18
18
19
extern const char bad_pmd_string[];
19
extern const char bad_pmd_string[];
20
20
21
#define __pmd_alloc_one(mm,address,mask)       ({ BUG(); ((pmd_t *)2); })
21
#define pmd_alloc_one(mm,address)       ({ BUG(); ((pmd_t *)2); })
22
#define pmd_alloc_one(mm,address)       ({ BUG(); ((pmd_t *)2); })
22
23
23
24
Lines 38-47 do { \ Link Here
38
	tlb_remove_page((tlb), pte);			\
39
	tlb_remove_page((tlb), pte);			\
39
} while (0)
40
} while (0)
40
41
41
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
42
static inline pte_t *
42
					  unsigned long address)
43
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
44
		gfp_t gfp_mask)
43
{
45
{
44
	unsigned long page = __get_free_page(GFP_KERNEL|__GFP_REPEAT);
46
	unsigned long page = __get_free_page(gfp_mask);
45
47
46
	if (!page)
48
	if (!page)
47
		return NULL;
49
		return NULL;
Lines 50-55 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, Link Here
50
	return (pte_t *) (page);
52
	return (pte_t *) (page);
51
}
53
}
52
54
55
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
56
					  unsigned long address)
57
{
58
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
59
}
60
53
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
61
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
54
					unsigned long address)
62
					unsigned long address)
55
{
63
{
(-)a/arch/m68k/mm/memory.c (-2 / +7 lines)
Lines 59-65 void __init init_pointer_table(unsigned long ptable) Link Here
59
	return;
59
	return;
60
}
60
}
61
61
62
pmd_t *get_pointer_table (void)
62
pmd_t *__get_pointer_table (gfp_t gfp_mask)
63
{
63
{
64
	ptable_desc *dp = ptable_list.next;
64
	ptable_desc *dp = ptable_list.next;
65
	unsigned char mask = PD_MARKBITS (dp);
65
	unsigned char mask = PD_MARKBITS (dp);
Lines 76-82 pmd_t *get_pointer_table (void) Link Here
76
		void *page;
76
		void *page;
77
		ptable_desc *new;
77
		ptable_desc *new;
78
78
79
		if (!(page = (void *)get_zeroed_page(GFP_KERNEL)))
79
		if (!(page = (void *)get_zeroed_page(gfp_mask)))
80
			return NULL;
80
			return NULL;
81
81
82
		flush_tlb_kernel_page(page);
82
		flush_tlb_kernel_page(page);
Lines 99-104 pmd_t *get_pointer_table (void) Link Here
99
	return (pmd_t *) (page_address(PD_PAGE(dp)) + off);
99
	return (pmd_t *) (page_address(PD_PAGE(dp)) + off);
100
}
100
}
101
101
102
pmd_t *get_pointer_table (void)
103
{
104
	return __get_pointer_table(GFP_KERNEL);
105
}
106
102
int free_pointer_table (pmd_t *ptable)
107
int free_pointer_table (pmd_t *ptable)
103
{
108
{
104
	ptable_desc *dp;
109
	ptable_desc *dp;
(-)a/arch/microblaze/include/asm/pgalloc.h (+3 lines)
Lines 106-114 extern inline void free_pgd_slow(pgd_t *pgd) Link Here
106
 * the pgd will always be present..
106
 * the pgd will always be present..
107
 */
107
 */
108
#define pmd_alloc_one_fast(mm, address)	({ BUG(); ((pmd_t *)1); })
108
#define pmd_alloc_one_fast(mm, address)	({ BUG(); ((pmd_t *)1); })
109
#define __pmd_alloc_one(mm, address,mask)	({ BUG(); ((pmd_t *)2); })
109
#define pmd_alloc_one(mm, address)	({ BUG(); ((pmd_t *)2); })
110
#define pmd_alloc_one(mm, address)	({ BUG(); ((pmd_t *)2); })
110
111
111
extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
112
extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
113
extern pte_t *__pte_alloc_one_kernel(struct mm_struct *, unsigned long, gfp_t);
112
114
113
static inline struct page *pte_alloc_one(struct mm_struct *mm,
115
static inline struct page *pte_alloc_one(struct mm_struct *mm,
114
		unsigned long address)
116
		unsigned long address)
Lines 175-180 extern inline void pte_free(struct mm_struct *mm, struct page *ptepage) Link Here
175
 * We don't have any real pmd's, and this code never triggers because
177
 * We don't have any real pmd's, and this code never triggers because
176
 * the pgd will always be present..
178
 * the pgd will always be present..
177
 */
179
 */
180
#define __pmd_alloc_one(mm, address,mask)	({ BUG(); ((pmd_t *)2); })
178
#define pmd_alloc_one(mm, address)	({ BUG(); ((pmd_t *)2); })
181
#define pmd_alloc_one(mm, address)	({ BUG(); ((pmd_t *)2); })
179
#define pmd_free(mm, x)			do { } while (0)
182
#define pmd_free(mm, x)			do { } while (0)
180
#define __pmd_free_tlb(tlb, x, addr)	pmd_free((tlb)->mm, x)
183
#define __pmd_free_tlb(tlb, x, addr)	pmd_free((tlb)->mm, x)
(-)a/arch/microblaze/mm/pgtable.c (-4 / +9 lines)
Lines 240-252 unsigned long iopa(unsigned long addr) Link Here
240
	return pa;
240
	return pa;
241
}
241
}
242
242
243
__init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
243
__init_refok pte_t *__pte_alloc_one_kernel(struct mm_struct *mm,
244
		unsigned long address)
244
		unsigned long address, gfp_t gfp_mask)
245
{
245
{
246
	pte_t *pte;
246
	pte_t *pte;
247
	if (mem_init_done) {
247
	if (mem_init_done) {
248
		pte = (pte_t *)__get_free_page(GFP_KERNEL |
248
		pte = (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
249
					__GFP_REPEAT | __GFP_ZERO);
250
	} else {
249
	} else {
251
		pte = (pte_t *)early_get_page();
250
		pte = (pte_t *)early_get_page();
252
		if (pte)
251
		if (pte)
Lines 254-256 __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, Link Here
254
	}
253
	}
255
	return pte;
254
	return pte;
256
}
255
}
256
257
__init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
258
		unsigned long address)
259
{
260
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
261
}
(-)a/arch/mips/include/asm/pgalloc.h (-7 / +15 lines)
Lines 64-77 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
64
	free_pages((unsigned long)pgd, PGD_ORDER);
64
	free_pages((unsigned long)pgd, PGD_ORDER);
65
}
65
}
66
66
67
static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm,
68
	unsigned long address, gfp_t gfp_mask)
69
{
70
	return (pte_t *) __get_free_pages(gfp_mask | __GFP_ZERO, PTE_ORDER);
71
}
72
67
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
73
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
68
	unsigned long address)
74
	unsigned long address)
69
{
75
{
70
	pte_t *pte;
76
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
71
72
	pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, PTE_ORDER);
73
74
	return pte;
75
}
77
}
76
78
77
static inline struct page *pte_alloc_one(struct mm_struct *mm,
79
static inline struct page *pte_alloc_one(struct mm_struct *mm,
Lines 106-121 do { \ Link Here
106
108
107
#ifndef __PAGETABLE_PMD_FOLDED
109
#ifndef __PAGETABLE_PMD_FOLDED
108
110
109
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
111
static inline pmd_t *
112
__pmd_alloc_one(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
110
{
113
{
111
	pmd_t *pmd;
114
	pmd_t *pmd;
112
115
113
	pmd = (pmd_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT, PMD_ORDER);
116
	pmd = (pmd_t *) __get_free_pages(gfp_mask, PMD_ORDER);
114
	if (pmd)
117
	if (pmd)
115
		pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
118
		pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
116
	return pmd;
119
	return pmd;
117
}
120
}
118
121
122
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
123
{
124
	return __pmd_alloc_one(mm, address, GFP_KERNEL | __GFP_REPEAT);
125
}
126
119
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
127
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
120
{
128
{
121
	free_pages((unsigned long)pmd, PMD_ORDER);
129
	free_pages((unsigned long)pmd, PMD_ORDER);
(-)a/arch/mn10300/include/asm/pgalloc.h (+2 lines)
Lines 37-42 extern pgd_t *pgd_alloc(struct mm_struct *); Link Here
37
extern void pgd_free(struct mm_struct *, pgd_t *);
37
extern void pgd_free(struct mm_struct *, pgd_t *);
38
38
39
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
39
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
40
extern pte_t *__pte_alloc_one_kernel(struct mm_struct *, unsigned long, gfp_t);
41
40
extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
42
extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
41
43
42
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
44
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
(-)a/arch/mn10300/mm/pgtable.c (-2 / +8 lines)
Lines 62-75 void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) Link Here
62
	local_flush_tlb_one(vaddr);
62
	local_flush_tlb_one(vaddr);
63
}
63
}
64
64
65
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
65
pte_t *__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
66
		gfp_t gfp_mask)
66
{
67
{
67
	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
68
	pte_t *pte = (pte_t *)__get_free_page(gfp_mask);
68
	if (pte)
69
	if (pte)
69
		clear_page(pte);
70
		clear_page(pte);
70
	return pte;
71
	return pte;
71
}
72
}
72
73
74
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
75
{
76
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
77
}
78
73
struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
79
struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
74
{
80
{
75
	struct page *pte;
81
	struct page *pte;
(-)a/arch/parisc/include/asm/pgalloc.h (-5 / +16 lines)
Lines 61-75 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd) Link Here
61
		        (__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT));
61
		        (__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT));
62
}
62
}
63
63
64
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
64
static inline pmd_t *
65
__pmd_alloc_one(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
65
{
66
{
66
	pmd_t *pmd = (pmd_t *)__get_free_pages(GFP_KERNEL|__GFP_REPEAT,
67
	pmd_t *pmd = (pmd_t *)__get_free_pages(gfp_mask, PMD_ORDER);
67
					       PMD_ORDER);
68
	if (pmd)
68
	if (pmd)
69
		memset(pmd, 0, PAGE_SIZE<<PMD_ORDER);
69
		memset(pmd, 0, PAGE_SIZE<<PMD_ORDER);
70
	return pmd;
70
	return pmd;
71
}
71
}
72
72
73
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
74
{
75
	return __pmd_alloc_one(mm, address, GFP_KERNEL | __GFP_REPEAT);
76
}
77
73
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
78
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
74
{
79
{
75
#ifdef CONFIG_64BIT
80
#ifdef CONFIG_64BIT
Lines 90-95 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) Link Here
90
 * inside the pgd, so has no extra memory associated with it.
95
 * inside the pgd, so has no extra memory associated with it.
91
 */
96
 */
92
97
98
#define __pmd_alloc_one(mm, addr, mask)		({ BUG(); ((pmd_t *)2); })
93
#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *)2); })
99
#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *)2); })
94
#define pmd_free(mm, x)			do { } while (0)
100
#define pmd_free(mm, x)			do { } while (0)
95
#define pgd_populate(mm, pmd, pte)	BUG()
101
#define pgd_populate(mm, pmd, pte)	BUG()
Lines 127-136 pte_alloc_one(struct mm_struct *mm, unsigned long address) Link Here
127
}
133
}
128
134
129
static inline pte_t *
135
static inline pte_t *
136
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
137
{
138
	return (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
139
}
140
141
static inline pte_t *
130
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
142
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
131
{
143
{
132
	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
144
	return __pte_alloc_one_kernel(mm, addr, GFP_KERNEL | __GFP_REPEAT);
133
	return pte;
134
}
145
}
135
146
136
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
147
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
(-)a/arch/powerpc/include/asm/pgalloc-32.h (+2 lines)
Lines 35-40 extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); Link Here
35
#endif
35
#endif
36
36
37
extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
37
extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
38
extern pte_t *__pte_alloc_one_kernel(struct mm_struct *, unsigned long, gfp_t);
39
38
extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr);
40
extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr);
39
41
40
static inline void pgtable_free(void *table, unsigned index_size)
42
static inline void pgtable_free(void *table, unsigned index_size)
(-)a/arch/powerpc/include/asm/pgalloc-64.h (-5 / +22 lines)
Lines 51-60 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
51
51
52
#define pgd_populate(MM, PGD, PUD)	pgd_set(PGD, PUD)
52
#define pgd_populate(MM, PGD, PUD)	pgd_set(PGD, PUD)
53
53
54
static inline pud_t *
55
__pud_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
56
{
57
	return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE), gfp_mask);
58
}
59
54
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
60
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
55
{
61
{
56
	return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE),
62
	return __pud_alloc_one(mm, addr, GFP_KERNEL | __GFP_REPEAT);
57
				GFP_KERNEL|__GFP_REPEAT);
58
}
63
}
59
64
60
static inline void pud_free(struct mm_struct *mm, pud_t *pud)
65
static inline void pud_free(struct mm_struct *mm, pud_t *pud)
Lines 89-98 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, Link Here
89
94
90
#endif /* CONFIG_PPC_64K_PAGES */
95
#endif /* CONFIG_PPC_64K_PAGES */
91
96
97
static inline pmd_t *
98
__pmd_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
99
{
100
	return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE), gfp_mask);
101
}
102
92
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
103
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
93
{
104
{
94
	return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE),
105
	return __pmd_alloc_one(mm, addr, GFP_KERNEL | __GFP_REPEAT);
95
				GFP_KERNEL|__GFP_REPEAT);
96
}
106
}
97
107
98
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
108
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
Lines 100-109 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) Link Here
100
	kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd);
110
	kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd);
101
}
111
}
102
112
113
static inline pte_t *
114
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
115
		gfp_t gfp_mask)
116
{
117
        return (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
118
}
119
103
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
120
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
104
					  unsigned long address)
121
					  unsigned long address)
105
{
122
{
106
        return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
123
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
107
}
124
}
108
125
109
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
126
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
(-)a/arch/powerpc/mm/pgtable_32.c (-2 / +8 lines)
Lines 95-108 void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
95
#endif
95
#endif
96
}
96
}
97
97
98
__init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
98
__init_refok pte_t *
99
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
99
{
100
{
100
	pte_t *pte;
101
	pte_t *pte;
101
	extern int mem_init_done;
102
	extern int mem_init_done;
102
	extern void *early_get_page(void);
103
	extern void *early_get_page(void);
103
104
104
	if (mem_init_done) {
105
	if (mem_init_done) {
105
		pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
106
		pte = (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
106
	} else {
107
	} else {
107
		pte = (pte_t *)early_get_page();
108
		pte = (pte_t *)early_get_page();
108
		if (pte)
109
		if (pte)
Lines 111-116 __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long add Link Here
111
	return pte;
112
	return pte;
112
}
113
}
113
114
115
__init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
116
{
117
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
118
}
119
114
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
120
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
115
{
121
{
116
	struct page *ptepage;
122
	struct page *ptepage;
(-)a/arch/s390/include/asm/pgalloc.h (-5 / +25 lines)
Lines 20-29 Link Here
20
#define check_pgt_cache()	do {} while (0)
20
#define check_pgt_cache()	do {} while (0)
21
21
22
unsigned long *crst_table_alloc(struct mm_struct *, int);
22
unsigned long *crst_table_alloc(struct mm_struct *, int);
23
unsigned long * __crst_table_alloc(struct mm_struct *, int , gfp_t);
23
void crst_table_free(struct mm_struct *, unsigned long *);
24
void crst_table_free(struct mm_struct *, unsigned long *);
24
void crst_table_free_rcu(struct mm_struct *, unsigned long *);
25
void crst_table_free_rcu(struct mm_struct *, unsigned long *);
25
26
26
unsigned long *page_table_alloc(struct mm_struct *);
27
unsigned long *page_table_alloc(struct mm_struct *);
28
unsigned long *__page_table_alloc(struct mm_struct *, gfp_t);
27
void page_table_free(struct mm_struct *, unsigned long *);
29
void page_table_free(struct mm_struct *, unsigned long *);
28
void page_table_free_rcu(struct mm_struct *, unsigned long *);
30
void page_table_free_rcu(struct mm_struct *, unsigned long *);
29
void disable_noexec(struct mm_struct *, struct task_struct *);
31
void disable_noexec(struct mm_struct *, struct task_struct *);
Lines 62-70 static inline unsigned long pgd_entry_type(struct mm_struct *mm) Link Here
62
	return _SEGMENT_ENTRY_EMPTY;
64
	return _SEGMENT_ENTRY_EMPTY;
63
}
65
}
64
66
67
#define __pud_alloc_one(mm,address,mask)		({ BUG(); ((pud_t *)2); })
65
#define pud_alloc_one(mm,address)		({ BUG(); ((pud_t *)2); })
68
#define pud_alloc_one(mm,address)		({ BUG(); ((pud_t *)2); })
66
#define pud_free(mm, x)				do { } while (0)
69
#define pud_free(mm, x)				do { } while (0)
67
70
71
#define __pmd_alloc_one(mm,address,mask)		({ BUG(); ((pmd_t *)2); })
68
#define pmd_alloc_one(mm,address)		({ BUG(); ((pmd_t *)2); })
72
#define pmd_alloc_one(mm,address)		({ BUG(); ((pmd_t *)2); })
69
#define pmd_free(mm, x)				do { } while (0)
73
#define pmd_free(mm, x)				do { } while (0)
70
74
Lines 88-109 static inline unsigned long pgd_entry_type(struct mm_struct *mm) Link Here
88
int crst_table_upgrade(struct mm_struct *, unsigned long limit);
92
int crst_table_upgrade(struct mm_struct *, unsigned long limit);
89
void crst_table_downgrade(struct mm_struct *, unsigned long limit);
93
void crst_table_downgrade(struct mm_struct *, unsigned long limit);
90
94
91
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
95
static inline pud_t *
96
__pud_alloc_one(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
92
{
97
{
93
	unsigned long *table = crst_table_alloc(mm, mm->context.noexec);
98
	unsigned long *table = __crst_table_alloc(mm, mm->context.noexec, gfp_mask);
94
	if (table)
99
	if (table)
95
		crst_table_init(table, _REGION3_ENTRY_EMPTY);
100
		crst_table_init(table, _REGION3_ENTRY_EMPTY);
96
	return (pud_t *) table;
101
	return (pud_t *) table;
97
}
102
}
103
104
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
105
{
106
	return __pud_alloc_one(mm, address, GFP_KERNEL);
107
}
98
#define pud_free(mm, pud) crst_table_free(mm, (unsigned long *) pud)
108
#define pud_free(mm, pud) crst_table_free(mm, (unsigned long *) pud)
99
109
100
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
110
static inline pmd_t *
111
__pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr, gfp_t gfp_mask)
101
{
112
{
102
	unsigned long *table = crst_table_alloc(mm, mm->context.noexec);
113
	unsigned long *table = __crst_table_alloc(mm, mm->context.noexec, gfp_mask);
103
	if (table)
114
	if (table)
104
		crst_table_init(table, _SEGMENT_ENTRY_EMPTY);
115
		crst_table_init(table, _SEGMENT_ENTRY_EMPTY);
105
	return (pmd_t *) table;
116
	return (pmd_t *) table;
106
}
117
}
118
119
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
120
{
121
	return __pmd_alloc_one(mm, vmaddr, GFP_KERNEL);
122
}
107
#define pmd_free(mm, pmd) crst_table_free(mm, (unsigned long *) pmd)
123
#define pmd_free(mm, pmd) crst_table_free(mm, (unsigned long *) pmd)
108
124
109
static inline void pgd_populate_kernel(struct mm_struct *mm,
125
static inline void pgd_populate_kernel(struct mm_struct *mm,
Lines 172-178 static inline void pmd_populate(struct mm_struct *mm, Link Here
172
/*
188
/*
173
 * page table entry allocation/free routines.
189
 * page table entry allocation/free routines.
174
 */
190
 */
175
#define pte_alloc_one_kernel(mm, vmaddr) ((pte_t *) page_table_alloc(mm))
191
#define __pte_alloc_one_kernel(mm, vmaddr, mask) \
192
	((pte_t *) __page_table_alloc((mm), (mask)))
193
#define pte_alloc_one_kernel(mm, vmaddr) \
194
	((pte_t *) __pte_alloc_one_kernel((mm), (vmaddr), GFP_KERNEL|__GFP_REPEAT)
195
176
#define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm))
196
#define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm))
177
197
178
#define pte_free_kernel(mm, pte) page_table_free(mm, (unsigned long *) pte)
198
#define pte_free_kernel(mm, pte) page_table_free(mm, (unsigned long *) pte)
(-)a/arch/s390/mm/pgtable.c (-5 / +17 lines)
Lines 125-139 static int __init parse_vmalloc(char *arg) Link Here
125
}
125
}
126
early_param("vmalloc", parse_vmalloc);
126
early_param("vmalloc", parse_vmalloc);
127
127
128
unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec)
128
unsigned long *
129
__crst_table_alloc(struct mm_struct *mm, int noexec, gfp_t gfp_mask)
129
{
130
{
130
	struct page *page = alloc_pages(GFP_KERNEL, ALLOC_ORDER);
131
	struct page *page = alloc_pages(gfp_mask, ALLOC_ORDER);
131
132
132
	if (!page)
133
	if (!page)
133
		return NULL;
134
		return NULL;
134
	page->index = 0;
135
	page->index = 0;
135
	if (noexec) {
136
	if (noexec) {
136
		struct page *shadow = alloc_pages(GFP_KERNEL, ALLOC_ORDER);
137
		struct page *shadow = alloc_pages(gfp_mask, ALLOC_ORDER);
137
		if (!shadow) {
138
		if (!shadow) {
138
			__free_pages(page, ALLOC_ORDER);
139
			__free_pages(page, ALLOC_ORDER);
139
			return NULL;
140
			return NULL;
Lines 146-151 unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec) Link Here
146
	return (unsigned long *) page_to_phys(page);
147
	return (unsigned long *) page_to_phys(page);
147
}
148
}
148
149
150
unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec)
151
{
152
	return __crst_table_alloc(mm, noexec, GFP_KERNEL);
153
}
154
149
static void __crst_table_free(struct mm_struct *mm, unsigned long *table)
155
static void __crst_table_free(struct mm_struct *mm, unsigned long *table)
150
{
156
{
151
	unsigned long *shadow = get_shadow_table(table);
157
	unsigned long *shadow = get_shadow_table(table);
Lines 267-273 void crst_table_downgrade(struct mm_struct *mm, unsigned long limit) Link Here
267
/*
273
/*
268
 * page table entry allocation/free routines.
274
 * page table entry allocation/free routines.
269
 */
275
 */
270
unsigned long *page_table_alloc(struct mm_struct *mm)
276
unsigned long *__page_table_alloc(struct mm_struct *mm, gfp_t gfp_mask)
271
{
277
{
272
	struct page *page;
278
	struct page *page;
273
	unsigned long *table;
279
	unsigned long *table;
Lines 284-290 unsigned long *page_table_alloc(struct mm_struct *mm) Link Here
284
	}
290
	}
285
	if (!page) {
291
	if (!page) {
286
		spin_unlock_bh(&mm->context.list_lock);
292
		spin_unlock_bh(&mm->context.list_lock);
287
		page = alloc_page(GFP_KERNEL|__GFP_REPEAT);
293
		page = alloc_page(gfp_mask);
288
		if (!page)
294
		if (!page)
289
			return NULL;
295
			return NULL;
290
		pgtable_page_ctor(page);
296
		pgtable_page_ctor(page);
Lines 309-314 unsigned long *page_table_alloc(struct mm_struct *mm) Link Here
309
	return table;
315
	return table;
310
}
316
}
311
317
318
319
unsigned long *page_table_alloc(struct mm_struct *mm)
320
{
321
	return __page_table_alloc(mm, GFP_KERNEL | __GFP_REPEAT);
322
}
323
312
static void __page_table_free(struct mm_struct *mm, unsigned long *table)
324
static void __page_table_free(struct mm_struct *mm, unsigned long *table)
313
{
325
{
314
	struct page *page;
326
	struct page *page;
(-)a/arch/score/include/asm/pgalloc.h (-6 / +7 lines)
Lines 37-51 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
37
	free_pages((unsigned long)pgd, PGD_ORDER);
37
	free_pages((unsigned long)pgd, PGD_ORDER);
38
}
38
}
39
39
40
static inline pte_t *
41
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
42
{
43
	return (pte_t *) __get_free_pages(gfp_mask | __GFP_ZERO, PTE_ORDER);
44
}
45
40
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
46
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
41
	unsigned long address)
47
	unsigned long address)
42
{
48
{
43
	pte_t *pte;
49
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
44
45
	pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO,
46
					PTE_ORDER);
47
48
	return pte;
49
}
50
}
50
51
51
static inline struct page *pte_alloc_one(struct mm_struct *mm,
52
static inline struct page *pte_alloc_one(struct mm_struct *mm,
(-)a/arch/sh/include/asm/pgalloc.h (-1 / +7 lines)
Lines 31-40 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, Link Here
31
/*
31
/*
32
 * Allocate and free page tables.
32
 * Allocate and free page tables.
33
 */
33
 */
34
static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm,
35
					  unsigned long address, gfp_t gfp_mask)
36
{
37
	return quicklist_alloc(QUICK_PT, gfp_mask, NULL);
38
}
39
34
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
40
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
35
					  unsigned long address)
41
					  unsigned long address)
36
{
42
{
37
	return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
43
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
38
}
44
}
39
45
40
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
46
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
(-)a/arch/sh/mm/pgtable.c (-1 / +7 lines)
Lines 45-53 void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) Link Here
45
	set_pud(pud, __pud((unsigned long)pmd));
45
	set_pud(pud, __pud((unsigned long)pmd));
46
}
46
}
47
47
48
pmd_t *
49
__pmd_alloc_one(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
50
{
51
	return kmem_cache_alloc(pmd_cachep, gfp_mask | __GFP_ZERO);
52
}
53
48
pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
54
pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
49
{
55
{
50
	return kmem_cache_alloc(pmd_cachep, PGALLOC_GFP);
56
	return __pmd_alloc_one(mm, address, GFP_KERNEL | __GFP_REPEAT);
51
}
57
}
52
58
53
void pmd_free(struct mm_struct *mm, pmd_t *pmd)
59
void pmd_free(struct mm_struct *mm, pmd_t *pmd)
(-)a/arch/sparc/include/asm/pgalloc_32.h (+5 lines)
Lines 41-46 BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *) Link Here
41
BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long)
41
BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long)
42
#define pmd_alloc_one(mm, address)	BTFIXUP_CALL(pmd_alloc_one)(mm, address)
42
#define pmd_alloc_one(mm, address)	BTFIXUP_CALL(pmd_alloc_one)(mm, address)
43
43
44
BTFIXUPDEF_CALL(pmd_t *, __pmd_alloc_one, struct mm_struct *, unsigned long, gfp_t)
45
#define __pmd_alloc_one(mm, address, gfp_mask)	BTFIXUP_CALL(pmd_alloc_one)(mm, address)
46
44
BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *)
47
BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *)
45
#define free_pmd_fast(pmd)	BTFIXUP_CALL(free_pmd_fast)(pmd)
48
#define free_pmd_fast(pmd)	BTFIXUP_CALL(free_pmd_fast)(pmd)
46
49
Lines 57-62 BTFIXUPDEF_CALL(pgtable_t , pte_alloc_one, struct mm_struct *, unsigned long) Link Here
57
#define pte_alloc_one(mm, address)	BTFIXUP_CALL(pte_alloc_one)(mm, address)
60
#define pte_alloc_one(mm, address)	BTFIXUP_CALL(pte_alloc_one)(mm, address)
58
BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long)
61
BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long)
59
#define pte_alloc_one_kernel(mm, addr)	BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr)
62
#define pte_alloc_one_kernel(mm, addr)	BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr)
63
BTFIXUPDEF_CALL(pte_t *, __pte_alloc_one_kernel, struct mm_struct *, unsigned long, gfp_t)
64
#define __pte_alloc_one_kernel(mm, addr, gfp_mask)	BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr)
60
65
61
BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *)
66
BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *)
62
#define pte_free_kernel(mm, pte)	BTFIXUP_CALL(free_pte_fast)(pte)
67
#define pte_free_kernel(mm, pte)	BTFIXUP_CALL(free_pte_fast)(pte)
(-)a/arch/sparc/include/asm/pgalloc_64.h (-2 / +15 lines)
Lines 26-34 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
26
26
27
#define pud_populate(MM, PUD, PMD)	pud_set(PUD, PMD)
27
#define pud_populate(MM, PUD, PMD)	pud_set(PUD, PMD)
28
28
29
static inline pmd_t *
30
__pmd_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
31
{
32
	return quicklist_alloc(0, gfp_mask, NULL);
33
}
34
29
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
35
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
30
{
36
{
31
	return quicklist_alloc(0, GFP_KERNEL, NULL);
37
	return __pmd_alloc_one(mm, addr, GFP_KERNEL);
32
}
38
}
33
39
34
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
40
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
Lines 36-45 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) Link Here
36
	quicklist_free(0, NULL, pmd);
42
	quicklist_free(0, NULL, pmd);
37
}
43
}
38
44
45
static inline pte_t *
46
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
47
		gfp_t gfp_mask)
48
{
49
	return quicklist_alloc(0, gfp_mask, NULL);
50
}
51
39
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
52
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
40
					  unsigned long address)
53
					  unsigned long address)
41
{
54
{
42
	return quicklist_alloc(0, GFP_KERNEL, NULL);
55
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL);
43
}
56
}
44
57
45
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
58
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
(-)a/arch/tile/include/asm/pgalloc.h (-1 / +12 lines)
Lines 69-82 extern pgd_t *pgd_alloc(struct mm_struct *mm); Link Here
69
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
69
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
70
70
71
extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address);
71
extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address);
72
extern pgtable_t __pte_alloc_one(struct mm_struct *, unsigned long, gfp_t);
73
72
extern void pte_free(struct mm_struct *mm, struct page *pte);
74
extern void pte_free(struct mm_struct *mm, struct page *pte);
73
75
74
#define pmd_pgtable(pmd) pmd_page(pmd)
76
#define pmd_pgtable(pmd) pmd_page(pmd)
75
77
76
static inline pte_t *
78
static inline pte_t *
79
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
80
		gfp_t gfp_mask)
81
{
82
	return pfn_to_kaddr(page_to_pfn(__pte_alloc_one(mm, address, gfp_mask)));
83
}
84
85
static inline pte_t *
77
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
86
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
78
{
87
{
79
	return pfn_to_kaddr(page_to_pfn(pte_alloc_one(mm, address)));
88
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
80
}
89
}
81
90
82
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
91
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
Lines 108-113 void shatter_pmd(pmd_t *pmd); Link Here
108
#define L1_USER_PGTABLE_ORDER L2_USER_PGTABLE_ORDER
117
#define L1_USER_PGTABLE_ORDER L2_USER_PGTABLE_ORDER
109
#define pud_populate(mm, pud, pmd) \
118
#define pud_populate(mm, pud, pmd) \
110
  pmd_populate_kernel((mm), (pmd_t *)(pud), (pte_t *)(pmd))
119
  pmd_populate_kernel((mm), (pmd_t *)(pud), (pte_t *)(pmd))
120
#define __pmd_alloc_one(mm, addr, mask) \
121
  ((pmd_t *)page_to_virt(__pte_alloc_one((mm), (addr), (mask))))
111
#define pmd_alloc_one(mm, addr) \
122
#define pmd_alloc_one(mm, addr) \
112
  ((pmd_t *)page_to_virt(pte_alloc_one((mm), (addr))))
123
  ((pmd_t *)page_to_virt(pte_alloc_one((mm), (addr))))
113
#define pmd_free(mm, pmdp) \
124
#define pmd_free(mm, pmdp) \
(-)a/arch/tile/mm/pgtable.c (-2 / +8 lines)
Lines 218-226 void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
218
218
219
#define L2_USER_PGTABLE_PAGES (1 << L2_USER_PGTABLE_ORDER)
219
#define L2_USER_PGTABLE_PAGES (1 << L2_USER_PGTABLE_ORDER)
220
220
221
struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
221
struct page *
222
__pte_alloc_one(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
222
{
223
{
223
	gfp_t flags = GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO|__GFP_COMP;
224
	gfp_t flags = gfp_mask | __GFP_ZERO | __GFP_COMP;
224
	struct page *p;
225
	struct page *p;
225
226
226
#ifdef CONFIG_HIGHPTE
227
#ifdef CONFIG_HIGHPTE
Lines 235-240 struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) Link Here
235
	return p;
236
	return p;
236
}
237
}
237
238
239
struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
240
{
241
	return __pte_alloc_one(mm, address, GFP_KERNEL);
242
}
243
238
/*
244
/*
239
 * Free page immediately (used in __pte_alloc if we raced with another
245
 * Free page immediately (used in __pte_alloc if we raced with another
240
 * process).  We have to correct whatever pte_alloc_one() did before
246
 * process).  We have to correct whatever pte_alloc_one() did before
(-)a/arch/um/include/asm/pgalloc.h (+1 lines)
Lines 27-32 extern pgd_t *pgd_alloc(struct mm_struct *); Link Here
27
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
27
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
28
28
29
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
29
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
30
extern pte_t *__pte_alloc_one_kernel(struct mm_struct *, unsigned long, gfp_t);
30
extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
31
extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
31
32
32
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
33
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
(-)a/arch/um/kernel/mem.c (-6 / +15 lines)
Lines 284-295 void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
284
	free_page((unsigned long) pgd);
284
	free_page((unsigned long) pgd);
285
}
285
}
286
286
287
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
287
pte_t *
288
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
288
{
289
{
289
	pte_t *pte;
290
	return (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
291
}
290
292
291
	pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
293
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
292
	return pte;
294
{
295
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
293
}
296
}
294
297
295
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
298
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
Lines 303-317 pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) Link Here
303
}
306
}
304
307
305
#ifdef CONFIG_3_LEVEL_PGTABLES
308
#ifdef CONFIG_3_LEVEL_PGTABLES
306
pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
309
pmd_t *
310
__pmd_alloc_one(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
307
{
311
{
308
	pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL);
312
	pmd_t *pmd = (pmd_t *) __get_free_page(gfp_mask);
309
313
310
	if (pmd)
314
	if (pmd)
311
		memset(pmd, 0, PAGE_SIZE);
315
		memset(pmd, 0, PAGE_SIZE);
312
316
313
	return pmd;
317
	return pmd;
314
}
318
}
319
320
pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
321
{
322
	return __pmd_alloc_one(mm, address, GFP_KERNEL);
323
}
315
#endif
324
#endif
316
325
317
void *uml_kmalloc(int size, int flags)
326
void *uml_kmalloc(int size, int flags)
(-)a/arch/x86/include/asm/pgalloc.h (-2 / +15 lines)
Lines 34-39 extern pgd_t *pgd_alloc(struct mm_struct *); Link Here
34
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
34
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
35
35
36
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
36
extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
37
extern pte_t *__pte_alloc_one_kernel(struct mm_struct *, unsigned long, gfp_t);
37
extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
38
extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
38
39
39
/* Should really implement gc for free page table pages. This could be
40
/* Should really implement gc for free page table pages. This could be
Lines 78-86 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, Link Here
78
#define pmd_pgtable(pmd) pmd_page(pmd)
79
#define pmd_pgtable(pmd) pmd_page(pmd)
79
80
80
#if PAGETABLE_LEVELS > 2
81
#if PAGETABLE_LEVELS > 2
82
static inline pmd_t *
83
__pmd_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
84
{
85
	return (pmd_t *)get_zeroed_page(gfp_mask);
86
}
87
81
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
88
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
82
{
89
{
83
	return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
90
	return __pmd_alloc_one(mm, addr, GFP_KERNEL | __GFP_REPEAT);
84
}
91
}
85
92
86
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
93
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
Lines 114-122 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) Link Here
114
	set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud)));
121
	set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud)));
115
}
122
}
116
123
124
static inline pud_t *
125
__pud_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
126
{
127
	return (pud_t *)get_zeroed_page(gfp_mask);
128
}
129
117
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
130
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
118
{
131
{
119
	return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
132
	return __pud_alloc_one(mm, addr, GFP_KERNEL | __GFP_REPEAT);
120
}
133
}
121
134
122
static inline void pud_free(struct mm_struct *mm, pud_t *pud)
135
static inline void pud_free(struct mm_struct *mm, pud_t *pud)
(-)a/arch/x86/mm/pgtable.c (-1 / +7 lines)
Lines 15-23 Link Here
15
15
16
gfp_t __userpte_alloc_gfp = PGALLOC_GFP | PGALLOC_USER_GFP;
16
gfp_t __userpte_alloc_gfp = PGALLOC_GFP | PGALLOC_USER_GFP;
17
17
18
pte_t *
19
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, gfp_t gfp_mask)
20
{
21
	return (pte_t *)__get_free_page(gfp_mask | __GFP_NOTRACK | __GFP_ZERO);
22
}
23
18
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
24
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
19
{
25
{
20
	return (pte_t *)__get_free_page(PGALLOC_GFP);
26
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
21
}
27
}
22
28
23
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
29
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
(-)a/arch/xtensa/include/asm/pgalloc.h (-1 / +8 lines)
Lines 42-51 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) Link Here
42
42
43
extern struct kmem_cache *pgtable_cache;
43
extern struct kmem_cache *pgtable_cache;
44
44
45
static inline pte_t *
46
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
47
		gfp_t gfp_mask)
48
{
49
	return kmem_cache_alloc(pgtable_cache, gfp_mask);
50
}
51
45
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 
52
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 
46
					 unsigned long address)
53
					 unsigned long address)
47
{
54
{
48
	return kmem_cache_alloc(pgtable_cache, GFP_KERNEL|__GFP_REPEAT);
55
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
49
}
56
}
50
57
51
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
58
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
(-)a/arch/xtensa/mm/pgtable.c (-2 / +9 lines)
Lines 12-24 Link Here
12
12
13
#if (DCACHE_SIZE > PAGE_SIZE)
13
#if (DCACHE_SIZE > PAGE_SIZE)
14
14
15
pte_t* pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
15
pte_t* 
16
__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address, 
17
		gfp_t gfp_mask)
16
{
18
{
17
	pte_t *pte = NULL, *p;
19
	pte_t *pte = NULL, *p;
18
	int color = ADDR_COLOR(address);
20
	int color = ADDR_COLOR(address);
19
	int i;
21
	int i;
20
22
21
	p = (pte_t*) __get_free_pages(GFP_KERNEL|__GFP_REPEAT, COLOR_ORDER);
23
	p = (pte_t*) __get_free_pages(gfp_mask, COLOR_ORDER);
22
24
23
	if (likely(p)) {
25
	if (likely(p)) {
24
		split_page(virt_to_page(p), COLOR_ORDER);
26
		split_page(virt_to_page(p), COLOR_ORDER);
Lines 35-40 pte_t* pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) Link Here
35
	return pte;
37
	return pte;
36
}
38
}
37
39
40
pte_t* pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
41
{
42
	return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
43
}
44
38
#ifdef PROFILING
45
#ifdef PROFILING
39
46
40
int mask;
47
int mask;
(-)a/include/asm-generic/4level-fixup.h (-2 / +6 lines)
Lines 10-19 Link Here
10
10
11
#define pud_t				pgd_t
11
#define pud_t				pgd_t
12
12
13
#define pmd_alloc(mm, pud, address) \
13
#define pmd_alloc_with_mask(mm, pud, address, mask) \
14
	((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \
14
	((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address, mask))? \
15
 		NULL: pmd_offset(pud, address))
15
 		NULL: pmd_offset(pud, address))
16
16
17
#define pmd_alloc(mm, pud, address) \
18
	pmd_alloc_with_mask(mm, pud, address, GFP_KERNEL)
19
20
#define pud_alloc_with_mask(mm, pgd, address, mask)	(pgd)
17
#define pud_alloc(mm, pgd, address)	(pgd)
21
#define pud_alloc(mm, pgd, address)	(pgd)
18
#define pud_offset(pgd, start)		(pgd)
22
#define pud_offset(pgd, start)		(pgd)
19
#define pud_none(pud)			0
23
#define pud_none(pud)			0
(-)a/include/asm-generic/pgtable-nopmd.h (-1 / +2 lines)
Lines 55-61 static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address) Link Here
55
 * allocating and freeing a pmd is trivial: the 1-entry pmd is
55
 * allocating and freeing a pmd is trivial: the 1-entry pmd is
56
 * inside the pud, so has no extra memory associated with it.
56
 * inside the pud, so has no extra memory associated with it.
57
 */
57
 */
58
#define pmd_alloc_one(mm, address)		NULL
58
#define __pmd_alloc_one(mm, address, mask)		NULL
59
#define pmd_alloc_one(mm, address)				NULL
59
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
60
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
60
{
61
{
61
}
62
}
(-)a/include/asm-generic/pgtable-nopud.h (+1 lines)
Lines 50-55 static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address) Link Here
50
 * allocating and freeing a pud is trivial: the 1-entry pud is
50
 * allocating and freeing a pud is trivial: the 1-entry pud is
51
 * inside the pgd, so has no extra memory associated with it.
51
 * inside the pgd, so has no extra memory associated with it.
52
 */
52
 */
53
#define __pud_alloc_one(mm, address, mask)		NULL
53
#define pud_alloc_one(mm, address)		NULL
54
#define pud_alloc_one(mm, address)		NULL
54
#define pud_free(mm, x)				do { } while (0)
55
#define pud_free(mm, x)				do { } while (0)
55
#define __pud_free_tlb(tlb, x, a)		do { } while (0)
56
#define __pud_free_tlb(tlb, x, a)		do { } while (0)
(-)a/include/linux/mm.h (-10 / +30 lines)
Lines 1156-1199 static inline pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, Link Here
1156
1156
1157
#ifdef __PAGETABLE_PUD_FOLDED
1157
#ifdef __PAGETABLE_PUD_FOLDED
1158
static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
1158
static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
1159
						unsigned long address)
1159
						unsigned long address, gfp_t gfp_mask)
1160
{
1160
{
1161
	return 0;
1161
	return 0;
1162
}
1162
}
1163
#else
1163
#else
1164
int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
1164
int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address, 
1165
		gfp_t gfp_mask);
1165
#endif
1166
#endif
1166
1167
1167
#ifdef __PAGETABLE_PMD_FOLDED
1168
#ifdef __PAGETABLE_PMD_FOLDED
1168
static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud,
1169
static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud,
1169
						unsigned long address)
1170
						unsigned long address, gfp_t gfp_mask)
1170
{
1171
{
1171
	return 0;
1172
	return 0;
1172
}
1173
}
1173
#else
1174
#else
1174
int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
1175
int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address, 
1176
		gfp_t gfp_mask);
1175
#endif
1177
#endif
1176
1178
1177
int __pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
1179
int __pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
1178
		pmd_t *pmd, unsigned long address);
1180
		pmd_t *pmd, unsigned long address);
1179
int __pte_alloc_kernel(pmd_t *pmd, unsigned long address);
1181
int __pte_alloc_kernel(pmd_t *pmd, unsigned long address, gfp_t gfp_mask);
1180
1182
1181
/*
1183
/*
1182
 * The following ifdef needed to get the 4level-fixup.h header to work.
1184
 * The following ifdef needed to get the 4level-fixup.h header to work.
1183
 * Remove it when 4level-fixup.h has been removed.
1185
 * Remove it when 4level-fixup.h has been removed.
1184
 */
1186
 */
1185
#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
1187
#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
1186
static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
1188
static inline pud_t *pud_alloc_with_mask(struct mm_struct *mm, pgd_t *pgd, 
1189
		unsigned long address, gfp_t gfp_mask)
1187
{
1190
{
1188
	return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
1191
	return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address, gfp_mask))?
1189
		NULL: pud_offset(pgd, address);
1192
		NULL: pud_offset(pgd, address);
1190
}
1193
}
1191
1194
1192
static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
1195
static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, 
1196
		unsigned long address)
1193
{
1197
{
1194
	return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))?
1198
	return pud_alloc_with_mask(mm, pgd, address, GFP_KERNEL);
1199
}
1200
1201
static inline pmd_t *pmd_alloc_with_mask(struct mm_struct *mm, pud_t *pud, 
1202
		unsigned long address, gfp_t gfp_mask)
1203
{
1204
	return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address, gfp_mask))?
1195
		NULL: pmd_offset(pud, address);
1205
		NULL: pmd_offset(pud, address);
1196
}
1206
}
1207
1208
static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, 
1209
		unsigned long address)
1210
{
1211
	return pmd_alloc_with_mask(mm, pud, address, GFP_KERNEL);
1212
}
1197
#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
1213
#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
1198
1214
1199
#if USE_SPLIT_PTLOCKS
1215
#if USE_SPLIT_PTLOCKS
Lines 1254-1261 static inline void pgtable_page_dtor(struct page *page) Link Here
1254
							pmd, address))?	\
1270
							pmd, address))?	\
1255
		NULL: pte_offset_map_lock(mm, pmd, address, ptlp))
1271
		NULL: pte_offset_map_lock(mm, pmd, address, ptlp))
1256
1272
1273
#define pte_alloc_kernel_with_mask(pmd, address, mask)			\
1274
	((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address, mask))? \
1275
		NULL: pte_offset_kernel(pmd, address))
1276
1257
#define pte_alloc_kernel(pmd, address)			\
1277
#define pte_alloc_kernel(pmd, address)			\
1258
	((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
1278
	((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address, GFP_KERNEL))? \
1259
		NULL: pte_offset_kernel(pmd, address))
1279
		NULL: pte_offset_kernel(pmd, address))
1260
1280
1261
extern void free_area_init(unsigned long * zones_size);
1281
extern void free_area_init(unsigned long * zones_size);
(-)a/mm/memory.c (-6 / +8 lines)
Lines 433-441 int __pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, Link Here
433
	return 0;
433
	return 0;
434
}
434
}
435
435
436
int __pte_alloc_kernel(pmd_t *pmd, unsigned long address)
436
int __pte_alloc_kernel(pmd_t *pmd, unsigned long address, gfp_t gfp_mask)
437
{
437
{
438
	pte_t *new = pte_alloc_one_kernel(&init_mm, address);
438
	pte_t *new = __pte_alloc_one_kernel(&init_mm, address, gfp_mask);
439
	if (!new)
439
	if (!new)
440
		return -ENOMEM;
440
		return -ENOMEM;
441
441
Lines 3343-3351 int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, Link Here
3343
 * Allocate page upper directory.
3343
 * Allocate page upper directory.
3344
 * We've already handled the fast-path in-line.
3344
 * We've already handled the fast-path in-line.
3345
 */
3345
 */
3346
int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
3346
int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address, 
3347
		gfp_t gfp_mask)
3347
{
3348
{
3348
	pud_t *new = pud_alloc_one(mm, address);
3349
	pud_t *new = __pud_alloc_one(mm, address, gfp_mask);
3349
	if (!new)
3350
	if (!new)
3350
		return -ENOMEM;
3351
		return -ENOMEM;
3351
3352
Lines 3366-3374 int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address) Link Here
3366
 * Allocate page middle directory.
3367
 * Allocate page middle directory.
3367
 * We've already handled the fast-path in-line.
3368
 * We've already handled the fast-path in-line.
3368
 */
3369
 */
3369
int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
3370
int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address, 
3371
		gfp_t gfp_mask)
3370
{
3372
{
3371
	pmd_t *new = pmd_alloc_one(mm, address);
3373
	pmd_t *new = __pmd_alloc_one(mm, address, gfp_mask);
3372
	if (!new)
3374
	if (!new)
3373
		return -ENOMEM;
3375
		return -ENOMEM;
3374
3376
(-)a/mm/vmalloc.c (-19 / +38 lines)
Lines 87-94 static void vunmap_page_range(unsigned long addr, unsigned long end) Link Here
87
	} while (pgd++, addr = next, addr != end);
87
	} while (pgd++, addr = next, addr != end);
88
}
88
}
89
89
90
static int vmap_pte_range(pmd_t *pmd, unsigned long addr,
90
static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, 
91
		unsigned long end, pgprot_t prot, struct page **pages, int *nr)
91
		pgprot_t prot, struct page **pages, int *nr, gfp_t gfp_mask)
92
{
92
{
93
	pte_t *pte;
93
	pte_t *pte;
94
94
Lines 97-103 static int vmap_pte_range(pmd_t *pmd, unsigned long addr, Link Here
97
	 * callers keep track of where we're up to.
97
	 * callers keep track of where we're up to.
98
	 */
98
	 */
99
99
100
	pte = pte_alloc_kernel(pmd, addr);
100
	pte = pte_alloc_kernel_with_mask(pmd, addr, gfp_mask);
101
	if (!pte)
101
	if (!pte)
102
		return -ENOMEM;
102
		return -ENOMEM;
103
	do {
103
	do {
Lines 114-147 static int vmap_pte_range(pmd_t *pmd, unsigned long addr, Link Here
114
}
114
}
115
115
116
static int vmap_pmd_range(pud_t *pud, unsigned long addr,
116
static int vmap_pmd_range(pud_t *pud, unsigned long addr,
117
		unsigned long end, pgprot_t prot, struct page **pages, int *nr)
117
		unsigned long end, pgprot_t prot, struct page **pages, int *nr, gfp_t gfp_mask)
118
{
118
{
119
	pmd_t *pmd;
119
	pmd_t *pmd;
120
	unsigned long next;
120
	unsigned long next;
121
121
122
	pmd = pmd_alloc(&init_mm, pud, addr);
122
	pmd = pmd_alloc_with_mask(&init_mm, pud, addr, gfp_mask);
123
	if (!pmd)
123
	if (!pmd)
124
		return -ENOMEM;
124
		return -ENOMEM;
125
	do {
125
	do {
126
		next = pmd_addr_end(addr, end);
126
		next = pmd_addr_end(addr, end);
127
		if (vmap_pte_range(pmd, addr, next, prot, pages, nr))
127
		if (vmap_pte_range(pmd, addr, next, prot, pages, nr, gfp_mask))
128
			return -ENOMEM;
128
			return -ENOMEM;
129
	} while (pmd++, addr = next, addr != end);
129
	} while (pmd++, addr = next, addr != end);
130
	return 0;
130
	return 0;
131
}
131
}
132
132
133
static int vmap_pud_range(pgd_t *pgd, unsigned long addr,
133
static int vmap_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end, 
134
		unsigned long end, pgprot_t prot, struct page **pages, int *nr)
134
		pgprot_t prot, struct page **pages, int *nr, gfp_t gfp_mask)
135
{
135
{
136
	pud_t *pud;
136
	pud_t *pud;
137
	unsigned long next;
137
	unsigned long next;
138
138
139
	pud = pud_alloc(&init_mm, pgd, addr);
139
	pud = pud_alloc_with_mask(&init_mm, pgd, addr, gfp_mask);
140
	if (!pud)
140
	if (!pud)
141
		return -ENOMEM;
141
		return -ENOMEM;
142
	do {
142
	do {
143
		next = pud_addr_end(addr, end);
143
		next = pud_addr_end(addr, end);
144
		if (vmap_pmd_range(pud, addr, next, prot, pages, nr))
144
		if (vmap_pmd_range(pud, addr, next, prot, pages, nr, gfp_mask))
145
			return -ENOMEM;
145
			return -ENOMEM;
146
	} while (pud++, addr = next, addr != end);
146
	} while (pud++, addr = next, addr != end);
147
	return 0;
147
	return 0;
Lines 153-160 static int vmap_pud_range(pgd_t *pgd, unsigned long addr, Link Here
153
 *
153
 *
154
 * Ie. pte at addr+N*PAGE_SIZE shall point to pfn corresponding to pages[N]
154
 * Ie. pte at addr+N*PAGE_SIZE shall point to pfn corresponding to pages[N]
155
 */
155
 */
156
static int vmap_page_range_noflush(unsigned long start, unsigned long end,
156
static int __vmap_page_range_noflush(unsigned long start, unsigned long end,
157
				   pgprot_t prot, struct page **pages)
157
				   pgprot_t prot, struct page **pages, gfp_t gfp_mask)
158
{
158
{
159
	pgd_t *pgd;
159
	pgd_t *pgd;
160
	unsigned long next;
160
	unsigned long next;
Lines 166-172 static int vmap_page_range_noflush(unsigned long start, unsigned long end, Link Here
166
	pgd = pgd_offset_k(addr);
166
	pgd = pgd_offset_k(addr);
167
	do {
167
	do {
168
		next = pgd_addr_end(addr, end);
168
		next = pgd_addr_end(addr, end);
169
		err = vmap_pud_range(pgd, addr, next, prot, pages, &nr);
169
		err = vmap_pud_range(pgd, addr, next, prot, pages, &nr, gfp_mask);
170
		if (err)
170
		if (err)
171
			return err;
171
			return err;
172
	} while (pgd++, addr = next, addr != end);
172
	} while (pgd++, addr = next, addr != end);
Lines 174-189 static int vmap_page_range_noflush(unsigned long start, unsigned long end, Link Here
174
	return nr;
174
	return nr;
175
}
175
}
176
176
177
static int vmap_page_range(unsigned long start, unsigned long end,
177
178
			   pgprot_t prot, struct page **pages)
178
static int vmap_page_range_noflush(unsigned long start, unsigned long end,
179
				   pgprot_t prot, struct page **pages)
180
{
181
	return __vmap_page_range_noflush(start, end, prot, pages, GFP_KERNEL);
182
}
183
184
static int __vmap_page_range(unsigned long start, unsigned long end,
185
			   pgprot_t prot, struct page **pages, gfp_t gfp_mask)
179
{
186
{
180
	int ret;
187
	int ret;
181
188
182
	ret = vmap_page_range_noflush(start, end, prot, pages);
189
	ret = __vmap_page_range_noflush(start, end, prot, pages, gfp_mask);
183
	flush_cache_vmap(start, end);
190
	flush_cache_vmap(start, end);
184
	return ret;
191
	return ret;
185
}
192
}
186
193
194
static int vmap_page_range(unsigned long start, unsigned long end,
195
			   pgprot_t prot, struct page **pages)
196
{
197
	return __vmap_page_range(start, end, prot, pages, GFP_KERNEL);
198
}
199
187
int is_vmalloc_or_module_addr(const void *x)
200
int is_vmalloc_or_module_addr(const void *x)
188
{
201
{
189
	/*
202
	/*
Lines 1194-1206 void unmap_kernel_range(unsigned long addr, unsigned long size) Link Here
1194
	flush_tlb_kernel_range(addr, end);
1207
	flush_tlb_kernel_range(addr, end);
1195
}
1208
}
1196
1209
1197
int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
1210
int __map_vm_area(struct vm_struct *area, pgprot_t prot, 
1211
		struct page ***pages, gfp_t gfp_mask)
1198
{
1212
{
1199
	unsigned long addr = (unsigned long)area->addr;
1213
	unsigned long addr = (unsigned long)area->addr;
1200
	unsigned long end = addr + area->size - PAGE_SIZE;
1214
	unsigned long end = addr + area->size - PAGE_SIZE;
1201
	int err;
1215
	int err;
1202
1216
1203
	err = vmap_page_range(addr, end, prot, *pages);
1217
	err = __vmap_page_range(addr, end, prot, *pages, gfp_mask);
1204
	if (err > 0) {
1218
	if (err > 0) {
1205
		*pages += err;
1219
		*pages += err;
1206
		err = 0;
1220
		err = 0;
Lines 1208-1213 int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) Link Here
1208
1222
1209
	return err;
1223
	return err;
1210
}
1224
}
1225
1226
int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
1227
{
1228
	return __map_vm_area(area, prot, pages, GFP_KERNEL);
1229
}
1211
EXPORT_SYMBOL_GPL(map_vm_area);
1230
EXPORT_SYMBOL_GPL(map_vm_area);
1212
1231
1213
/*** Old vmalloc interfaces ***/
1232
/*** Old vmalloc interfaces ***/
Lines 1522-1528 static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, Link Here
1522
		area->pages[i] = page;
1541
		area->pages[i] = page;
1523
	}
1542
	}
1524
1543
1525
	if (map_vm_area(area, prot, &pages))
1544
	if (__map_vm_area(area, prot, &pages, gfp_mask))
1526
		goto fail;
1545
		goto fail;
1527
	return area->addr;
1546
	return area->addr;
1528
1547

Return to bug 416685