lkml.org 
[lkml]   [2005]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] earlier allocation of order 0 pages from pcp in __alloc_pages
From
Date
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-30 00:52    [W:0.064 / U:4.272 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site