Re: [PATCH] earlier allocation of order 0 pages from pcp in __alloc_pages
From: Dave Hansen <hidden>
Date: 2005-09-29 22:50:09
Also in:
lkml
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, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>