Re: [RFC] i386: Remove page sized slabs for pgds and pmds

From: Chris Wright
Date: Wed Mar 28 2007 - 18:28:05 EST


* Christoph Lameter (clameter@xxxxxxx) wrote:
> +#ifdef CONFIG_HIGHMEM64G
> +#define __pgd_alloc() kmem_cache_alloc(pgd_cache, GFP_KERNEL|__GFP_REPEAT)
> +#define __pgd_free(pgd) kmem_cache_free(pgd_cache, pgd)

I must've glazed over something, I thought this was removal of slabs?

BTW, this will interact shared_kernel_pmd patch that Jeremy's posted a
few times (I know at least wli has looked over that one). We need to
make sure that PAE under at least Xen hypervisor has a page-sized pgd,
although the mmlist chaining looks nice to me.

> +static struct kmem_cache *pgd_cache;
> +
> +void __init pgtable_cache_init(void)
> +{
> + pgd_cache = kmem_cache_create("pgd",
> + PTRS_PER_PGD*sizeof(pgd_t),
> + PTRS_PER_PGD*sizeof(pgd_t),
> + SLAB_PANIC,
> + NULL,
> + NULL);
> +}
> +#else /* !CONFIG_HIGHMEM64G */
> +#define __pgd_alloc() ((pgd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT))
> +#define __pgd_free(pgd) free_page((unsigned long)(pgd))
> +#endif /* !CONFIG_HIGHMEM64G */
>
> pgd_t *pgd_alloc(struct mm_struct *mm)
> {
> int i;
> - pgd_t *pgd = kmem_cache_alloc(pgd_cache, GFP_KERNEL);
> + pgd_t *pgd = __pgd_alloc();
>
> - if (PTRS_PER_PMD == 1 || !pgd)
> + if (!pgd)
> + return NULL;
> + memcpy(&pgd[USER_PTRS_PER_PGD], &swapper_pg_dir[USER_PTRS_PER_PGD],
> + KERNEL_PGD_PTRS*sizeof(pgd_t));

clone_pgd_range() for consistency? and it seems we lost a paravirt_alloc_pd_clone()
in there somewhere.

> + if (PTRS_PER_PMD == 1)
> return pgd;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/