]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/frv/mm/pgalloc.c
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[linux-2.6-omap-h63xx.git] / arch / frv / mm / pgalloc.c
index 2c67dfe5a6b366d6e16e4569d86028593c17ff24..7787c3cc52c6923d58e305b4ae10c4e3ab6b87e1 100644 (file)
 #include <linux/slab.h>
 #include <linux/mm.h>
 #include <linux/highmem.h>
+#include <linux/quicklist.h>
 #include <asm/pgalloc.h>
 #include <asm/page.h>
 #include <asm/cacheflush.h>
 
 pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((aligned(PAGE_SIZE)));
-kmem_cache_t *pgd_cache;
 
 pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
@@ -85,7 +85,7 @@ static inline void pgd_list_add(pgd_t *pgd)
        struct page *page = virt_to_page(pgd);
        page->index = (unsigned long) pgd_list;
        if (pgd_list)
-               pgd_list->private = (unsigned long) &page->index;
+               set_page_private(pgd_list, (unsigned long) &page->index);
        pgd_list = page;
        set_page_private(page, (unsigned long)&pgd_list);
 }
@@ -94,13 +94,13 @@ static inline void pgd_list_del(pgd_t *pgd)
 {
        struct page *next, **pprev, *page = virt_to_page(pgd);
        next = (struct page *) page->index;
-       pprev = (struct page **)page_private(page);
+       pprev = (struct page **) page_private(page);
        *pprev = next;
        if (next)
-               next->private = (unsigned long) pprev;
+               set_page_private(next, (unsigned long) pprev);
 }
 
-void pgd_ctor(void *pgd, kmem_cache_t *cache, unsigned long unused)
+void pgd_ctor(void *pgd)
 {
        unsigned long flags;
 
@@ -120,7 +120,7 @@ void pgd_ctor(void *pgd, kmem_cache_t *cache, unsigned long unused)
 }
 
 /* never called when PTRS_PER_PMD > 1 */
-void pgd_dtor(void *pgd, kmem_cache_t *cache, unsigned long unused)
+void pgd_dtor(void *pgd)
 {
        unsigned long flags; /* can be called from interrupt context */
 
@@ -133,7 +133,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
 {
        pgd_t *pgd;
 
-       pgd = kmem_cache_alloc(pgd_cache, GFP_KERNEL);
+       pgd = quicklist_alloc(0, GFP_KERNEL, pgd_ctor);
        if (!pgd)
                return pgd;
 
@@ -143,17 +143,15 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
 void pgd_free(pgd_t *pgd)
 {
        /* in the non-PAE case, clear_page_tables() clears user pgd entries */
-       kmem_cache_free(pgd_cache, pgd);
+       quicklist_free(0, pgd_dtor, pgd);
 }
 
 void __init pgtable_cache_init(void)
 {
-       pgd_cache = kmem_cache_create("pgd",
-                                     PTRS_PER_PGD * sizeof(pgd_t),
-                                     PTRS_PER_PGD * sizeof(pgd_t),
-                                     0,
-                                     pgd_ctor,
-                                     pgd_dtor);
-       if (!pgd_cache)
-               panic("pgtable_cache_init(): Cannot create pgd cache");
 }
+
+void check_pgt_cache(void)
+{
+       quicklist_trim(0, pgd_dtor, 25, 16);
+}
+