diff options
Diffstat (limited to 'include/asm-avr32/pgalloc.h')
-rw-r--r-- | include/asm-avr32/pgalloc.h | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h index bb82e70cde8d..0e680f47209f 100644 --- a/include/asm-avr32/pgalloc.h +++ b/include/asm-avr32/pgalloc.h | |||
@@ -27,13 +27,7 @@ static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | |||
27 | */ | 27 | */ |
28 | static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) | 28 | static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) |
29 | { | 29 | { |
30 | unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); | 30 | return kcalloc(USER_PTRS_PER_PGD, sizeof(pgd_t), GFP_KERNEL); |
31 | pgd_t *pgd = kmalloc(pgd_size, GFP_KERNEL); | ||
32 | |||
33 | if (pgd) | ||
34 | memset(pgd, 0, pgd_size); | ||
35 | |||
36 | return pgd; | ||
37 | } | 31 | } |
38 | 32 | ||
39 | static inline void pgd_free(pgd_t *pgd) | 33 | static inline void pgd_free(pgd_t *pgd) |
@@ -44,18 +38,9 @@ static inline void pgd_free(pgd_t *pgd) | |||
44 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 38 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
45 | unsigned long address) | 39 | unsigned long address) |
46 | { | 40 | { |
47 | int count = 0; | ||
48 | pte_t *pte; | 41 | pte_t *pte; |
49 | 42 | ||
50 | do { | 43 | pte = (pte_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT); |
51 | pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT); | ||
52 | if (pte) | ||
53 | clear_page(pte); | ||
54 | else { | ||
55 | current->state = TASK_UNINTERRUPTIBLE; | ||
56 | schedule_timeout(HZ); | ||
57 | } | ||
58 | } while (!pte && (count++ < 10)); | ||
59 | 44 | ||
60 | return pte; | 45 | return pte; |
61 | } | 46 | } |
@@ -63,18 +48,9 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | |||
63 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | 48 | static inline struct page *pte_alloc_one(struct mm_struct *mm, |
64 | unsigned long address) | 49 | unsigned long address) |
65 | { | 50 | { |
66 | int count = 0; | ||
67 | struct page *pte; | 51 | struct page *pte; |
68 | 52 | ||
69 | do { | 53 | pte = alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); |
70 | pte = alloc_pages(GFP_KERNEL, 0); | ||
71 | if (pte) | ||
72 | clear_page(page_address(pte)); | ||
73 | else { | ||
74 | current->state = TASK_UNINTERRUPTIBLE; | ||
75 | schedule_timeout(HZ); | ||
76 | } | ||
77 | } while (!pte && (count++ < 10)); | ||
78 | 54 | ||
79 | return pte; | 55 | return pte; |
80 | } | 56 | } |