Re: [PATCH] earlier allocation of order 0 pages from pcp in__alloc_pages

From: Dave Hansen
Date: Thu Sep 29 2005 - 17:50:38 EST


On Thu, 2005-09-29 at 15:01 -0700, Seth, Rohit wrote:
> +/* This routine allocates a order 0 page from cpu's pcp list when one is present.
> + * It does not try to remove the pages from zone_free_list as the zone low
> + * water mark has not yet been checked.
> + */
> +
> +static struct page *
> +remove_from_pcp(struct zone *zone, unsigned int __nocast gfp_flags)
> +{
> + unsigned long flags;
> + struct per_cpu_pages *pcp;
> + struct page *page = NULL;
> + int cold = !!(gfp_flags & __GFP_COLD);
> +
> + pcp = &zone_pcp(zone, get_cpu())->pcp[cold];
> + local_irq_save(flags);
> + if (pcp->count > pcp->low) {
> + page = list_entry(pcp->list.next, struct page, lru);
> + list_del(&page->lru);
> + pcp->count--;
> + }
> + local_irq_restore(flags);
> + put_cpu();
> +
> + if (page != NULL) {
> + mod_page_state_zone(zone, pgalloc, 1 );
> + prep_new_page(page, 0);
> +
> + if (gfp_flags & __GFP_ZERO)
> + prep_zero_page(page, 0, gfp_flags);
> + }
> + return page;
> +}
> +

That looks to share a decent amount of logic with the pcp code in
buffered_rmqueue. Any chance it could be consolidated instead of
copy/pasting?

-- Dave

-
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/