summaryrefslogtreecommitdiffstats
path: root/include/asm-s390/pgalloc.h
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-24 01:52:47 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-24 01:52:47 -0400
commit23930fa1cebfea6f79881c588ccd1b0781e49e3f (patch)
tree36d29e3f83661c4f5f45b6f74ac0d5f9886867a8 /include/asm-s390/pgalloc.h
parent36b35a5be0e4b406acd816e2122d153e875105be (diff)
parent4f5537de7c1531398e84e18a24f667e49cc94208 (diff)
downloadop-kernel-dev-23930fa1cebfea6f79881c588ccd1b0781e49e3f.zip
op-kernel-dev-23930fa1cebfea6f79881c588ccd1b0781e49e3f.tar.gz
Merge branch 'master' into upstream
Diffstat (limited to 'include/asm-s390/pgalloc.h')
-rw-r--r--include/asm-s390/pgalloc.h67
1 files changed, 34 insertions, 33 deletions
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index a78e853..803bc70 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -22,6 +22,16 @@
extern void diag10(unsigned long addr);
/*
+ * Page allocation orders.
+ */
+#ifndef __s390x__
+# define PGD_ALLOC_ORDER 1
+#else /* __s390x__ */
+# define PMD_ALLOC_ORDER 2
+# define PGD_ALLOC_ORDER 2
+#endif /* __s390x__ */
+
+/*
* Allocate and free page tables. The xxx_kernel() versions are
* used to allocate a kernel page table - this turns on ASN bits
* if any.
@@ -29,30 +39,23 @@ extern void diag10(unsigned long addr);
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
{
- pgd_t *pgd;
+ pgd_t *pgd = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ALLOC_ORDER);
int i;
+ if (!pgd)
+ return NULL;
+ for (i = 0; i < PTRS_PER_PGD; i++)
#ifndef __s390x__
- pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,1);
- if (pgd != NULL)
- for (i = 0; i < USER_PTRS_PER_PGD; i++)
- pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE));
-#else /* __s390x__ */
- pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,2);
- if (pgd != NULL)
- for (i = 0; i < PTRS_PER_PGD; i++)
- pgd_clear(pgd + i);
-#endif /* __s390x__ */
+ pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE));
+#else
+ pgd_clear(pgd + i);
+#endif
return pgd;
}
static inline void pgd_free(pgd_t *pgd)
{
-#ifndef __s390x__
- free_pages((unsigned long) pgd, 1);
-#else /* __s390x__ */
- free_pages((unsigned long) pgd, 2);
-#endif /* __s390x__ */
+ free_pages((unsigned long) pgd, PGD_ALLOC_ORDER);
}
#ifndef __s390x__
@@ -68,20 +71,19 @@ static inline void pgd_free(pgd_t *pgd)
#else /* __s390x__ */
static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
{
- pmd_t *pmd;
- int i;
+ pmd_t *pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ALLOC_ORDER);
+ int i;
- pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2);
- if (pmd != NULL) {
- for (i=0; i < PTRS_PER_PMD; i++)
- pmd_clear(pmd+i);
- }
+ if (!pmd)
+ return NULL;
+ for (i=0; i < PTRS_PER_PMD; i++)
+ pmd_clear(pmd + i);
return pmd;
}
static inline void pmd_free (pmd_t *pmd)
{
- free_pages((unsigned long) pmd, 2);
+ free_pages((unsigned long) pmd, PMD_ALLOC_ORDER);
}
#define __pmd_free_tlb(tlb,pmd) \
@@ -123,15 +125,14 @@ pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page)
static inline pte_t *
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr)
{
- pte_t *pte;
- int i;
-
- pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
- if (pte != NULL) {
- for (i=0; i < PTRS_PER_PTE; i++) {
- pte_clear(mm, vmaddr, pte+i);
- vmaddr += PAGE_SIZE;
- }
+ pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL|__GFP_REPEAT);
+ int i;
+
+ if (!pte)
+ return NULL;
+ for (i=0; i < PTRS_PER_PTE; i++) {
+ pte_clear(mm, vmaddr, pte + i);
+ vmaddr += PAGE_SIZE;
}
return pte;
}
OpenPOWER on IntegriCloud