In-Reply-To: <[email protected]>
On Thu, 23 Feb 2006 at 10:29:54 +0100, Arjan van de Ven wrote:
> Index: linux-work/mm/mempolicy.c
> ===================================================================
> --- linux-work.orig/mm/mempolicy.c
> +++ linux-work/mm/mempolicy.c
> @@ -1231,6 +1231,13 @@ alloc_page_vma(gfp_t gfp, struct vm_area
> {
> struct mempolicy *pol = get_vma_policy(current, vma, addr);
>
> + if ( (gfp & __GFP_ZERO) && current->cleared_page) {
> + struct page *addr;
> + addr = current->cleared_page;
> + current->cleared_page = NULL;
> + return addr;
> + }
> +
> cpuset_update_task_memory_state();
>
> if (unlikely(pol->policy == MPOL_INTERLEAVE)) {
> @@ -1242,6 +1249,36 @@ alloc_page_vma(gfp_t gfp, struct vm_area
> return __alloc_pages(gfp, 0, zonelist_policy(gfp, pol));
> }
>
> +
> +/**
> + * prepare_cleared_page - populate the per-task zeroed-page cache
> + *
> + * This function populates the per-task cache with one zeroed page
> + * (if there wasn't one already)
> + * The idea is that this (expensive) clearing is done before any
> + * locks are taken, speculatively, and that when the page is actually
> + * needed under a lock, it is ready for immediate use
> + */
> +
> +void prepare_cleared_page(void)
> +{
> + struct mempolicy *pol = current->mempolicy;
> +
> + if (current->cleared_page)
> + return;
> +
> + cpuset_update_task_memory_state();
> +
> + if (!pol)
> + pol = &default_policy;
> + if (pol->policy == MPOL_INTERLEAVE)
> + current->cleared_page = alloc_page_interleave(
> + GFP_HIGHUSER | __GFP_ZERO, 0, interleave_nodes(pol));
======> else ???
> + current->cleared_page = __alloc_pages(GFP_USER | __GFP_ZERO,
> + 0, zonelist_policy(GFP_USER, pol));
> +}
> +
> +
> /**
> * alloc_pages_current - Allocate pages.
> *
--
Chuck
"Equations are the Devil's sentences." --Stephen Colbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]