patch-2.4.20 linux-2.4.20/include/asm-s390x/pgalloc.h

Next file: linux-2.4.20/include/asm-s390x/pgtable.h
Previous file: linux-2.4.20/include/asm-s390x/page.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/include/asm-s390x/pgalloc.h linux-2.4.20/include/asm-s390x/pgalloc.h
@@ -16,6 +16,7 @@
 #include <linux/config.h>
 #include <asm/processor.h>
 #include <linux/threads.h>
+#include <linux/slab.h>
 
 #define pgd_quicklist (S390_lowcore.cpu_data.pgd_quick)
 #define pmd_quicklist (S390_lowcore.cpu_data.pmd_quick)
@@ -36,7 +37,7 @@
 	pgd_t *ret;
         int i;
 
-	ret = (pgd_t *) __get_free_pages(GFP_KERNEL, 2);
+	ret = (pgd_t *) __get_free_pages(GFP_KERNEL, 1);
 	if (ret != NULL)
 	        for (i = 0; i < PTRS_PER_PGD; i++) 
 	                pgd_clear(ret + i);
@@ -50,7 +51,7 @@
 	if (ret != NULL) {
 		pgd_quicklist = (unsigned long *)(*ret);
 		ret[0] = ret[1];
-		pgtable_cache_size -= 4;
+		pgtable_cache_size -= 2;
 	}
 	return (pgd_t *) ret;
 }
@@ -69,20 +70,17 @@
 {
 	*(unsigned long *) pgd = (unsigned long) pgd_quicklist;
 	pgd_quicklist = (unsigned long *) pgd;
-	pgtable_cache_size += 4;
+	pgtable_cache_size += 2;
 }
 
 extern __inline__ void free_pgd_slow (pgd_t *pgd)
 {
-        free_pages((unsigned long) pgd, 2);
+	free_pages((unsigned long) pgd, 1);
 }
 
 #define pgd_free(pgd)		free_pgd_fast(pgd)
 
-extern inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
-{
-	pgd_val(*pgd) = _PGD_ENTRY | __pa(pmd);
-}
+extern pmd_t *pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd);
 
 /*
  * page middle directory allocation/free routines.
@@ -92,7 +90,7 @@
 	pmd_t *pmd;
         int i;
 
-	pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2);
+	pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 1);
 	if (pmd != NULL) {
 		for (i=0; i < PTRS_PER_PMD; i++)
 			pmd_clear(pmd+i);
@@ -108,21 +106,25 @@
 	if (ret != NULL) {
 		pmd_quicklist = (unsigned long *)(*ret);
 		ret[0] = ret[1];
-		pgtable_cache_size -= 4;
+		pgtable_cache_size -= 2;
 	}
 	return (pmd_t *) ret;
 }
 
+extern void pmd_free_order2(pmd_t *);
 extern __inline__ void pmd_free_fast (pmd_t *pmd)
 {
-	*(unsigned long *) pmd = (unsigned long) pmd_quicklist;
-	pmd_quicklist = (unsigned long *) pmd;
-	pgtable_cache_size += 4;
+	if (test_bit(PG_arch_1, &virt_to_page(pmd)->flags) == 0) {
+		*(unsigned long *) pmd = (unsigned long) pmd_quicklist;
+		pmd_quicklist = (unsigned long *) pmd;
+		pgtable_cache_size += 2;
+	} else
+		pmd_free_order2(pmd);
 }
 
 extern __inline__ void pmd_free_slow (pmd_t *pmd)
 {
-	free_pages((unsigned long) pmd, 2);
+	free_pages((unsigned long) pmd, 1);
 }
 
 #define pmd_free(pmd)		pmd_free_fast(pmd)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)