|
@@ -13,6 +13,7 @@
|
|
#include <linux/pagemap.h>
|
|
#include <linux/pagemap.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/module.h>
|
|
#include <linux/module.h>
|
|
|
|
+#include <linux/quicklist.h>
|
|
|
|
|
|
#include <asm/system.h>
|
|
#include <asm/system.h>
|
|
#include <asm/pgtable.h>
|
|
#include <asm/pgtable.h>
|
|
@@ -205,8 +206,6 @@ void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags)
|
|
* against pageattr.c; it is the unique case in which a valid change
|
|
* against pageattr.c; it is the unique case in which a valid change
|
|
* of kernel pagetables can't be lazily synchronized by vmalloc faults.
|
|
* of kernel pagetables can't be lazily synchronized by vmalloc faults.
|
|
* vmalloc faults work because attached pagetables are never freed.
|
|
* vmalloc faults work because attached pagetables are never freed.
|
|
- * The locking scheme was chosen on the basis of manfred's
|
|
|
|
- * recommendations and having no core impact whatsoever.
|
|
|
|
* -- wli
|
|
* -- wli
|
|
*/
|
|
*/
|
|
DEFINE_SPINLOCK(pgd_lock);
|
|
DEFINE_SPINLOCK(pgd_lock);
|
|
@@ -232,9 +231,11 @@ static inline void pgd_list_del(pgd_t *pgd)
|
|
set_page_private(next, (unsigned long)pprev);
|
|
set_page_private(next, (unsigned long)pprev);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
#if (PTRS_PER_PMD == 1)
|
|
#if (PTRS_PER_PMD == 1)
|
|
/* Non-PAE pgd constructor */
|
|
/* Non-PAE pgd constructor */
|
|
-void pgd_ctor(void *pgd, struct kmem_cache *cache, unsigned long unused)
|
|
|
|
|
|
+void pgd_ctor(void *pgd)
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
@@ -256,7 +257,7 @@ void pgd_ctor(void *pgd, struct kmem_cache *cache, unsigned long unused)
|
|
}
|
|
}
|
|
#else /* PTRS_PER_PMD > 1 */
|
|
#else /* PTRS_PER_PMD > 1 */
|
|
/* PAE pgd constructor */
|
|
/* PAE pgd constructor */
|
|
-void pgd_ctor(void *pgd, struct kmem_cache *cache, unsigned long unused)
|
|
|
|
|
|
+void pgd_ctor(void *pgd)
|
|
{
|
|
{
|
|
/* PAE, kernel PMD may be shared */
|
|
/* PAE, kernel PMD may be shared */
|
|
|
|
|
|
@@ -275,11 +276,12 @@ void pgd_ctor(void *pgd, struct kmem_cache *cache, unsigned long unused)
|
|
}
|
|
}
|
|
#endif /* PTRS_PER_PMD */
|
|
#endif /* PTRS_PER_PMD */
|
|
|
|
|
|
-void pgd_dtor(void *pgd, struct kmem_cache *cache, unsigned long unused)
|
|
|
|
|
|
+void pgd_dtor(void *pgd)
|
|
{
|
|
{
|
|
unsigned long flags; /* can be called from interrupt context */
|
|
unsigned long flags; /* can be called from interrupt context */
|
|
|
|
|
|
- BUG_ON(SHARED_KERNEL_PMD);
|
|
|
|
|
|
+ if (SHARED_KERNEL_PMD)
|
|
|
|
+ return;
|
|
|
|
|
|
paravirt_release_pd(__pa(pgd) >> PAGE_SHIFT);
|
|
paravirt_release_pd(__pa(pgd) >> PAGE_SHIFT);
|
|
spin_lock_irqsave(&pgd_lock, flags);
|
|
spin_lock_irqsave(&pgd_lock, flags);
|
|
@@ -321,7 +323,7 @@ static void pmd_cache_free(pmd_t *pmd, int idx)
|
|
pgd_t *pgd_alloc(struct mm_struct *mm)
|
|
pgd_t *pgd_alloc(struct mm_struct *mm)
|
|
{
|
|
{
|
|
int i;
|
|
int i;
|
|
- pgd_t *pgd = kmem_cache_alloc(pgd_cache, GFP_KERNEL);
|
|
|
|
|
|
+ pgd_t *pgd = quicklist_alloc(0, GFP_KERNEL, pgd_ctor);
|
|
|
|
|
|
if (PTRS_PER_PMD == 1 || !pgd)
|
|
if (PTRS_PER_PMD == 1 || !pgd)
|
|
return pgd;
|
|
return pgd;
|
|
@@ -344,7 +346,7 @@ out_oom:
|
|
paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT);
|
|
paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT);
|
|
pmd_cache_free(pmd, i);
|
|
pmd_cache_free(pmd, i);
|
|
}
|
|
}
|
|
- kmem_cache_free(pgd_cache, pgd);
|
|
|
|
|
|
+ quicklist_free(0, pgd_dtor, pgd);
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -361,5 +363,11 @@ void pgd_free(pgd_t *pgd)
|
|
pmd_cache_free(pmd, i);
|
|
pmd_cache_free(pmd, i);
|
|
}
|
|
}
|
|
/* in the non-PAE case, free_pgtables() clears user pgd entries */
|
|
/* in the non-PAE case, free_pgtables() clears user pgd entries */
|
|
- kmem_cache_free(pgd_cache, pgd);
|
|
|
|
|
|
+ quicklist_free(0, pgd_dtor, pgd);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void check_pgt_cache(void)
|
|
|
|
+{
|
|
|
|
+ quicklist_trim(0, pgd_dtor, 25, 16);
|
|
|
|
+}
|
|
|
|
+
|