[PATCH] earlier allocation of order 0 pages from pcp in __alloc_pages

From: Seth, Rohit (rohit.seth_at_intel.com)
Date: 09/30/05

  • Next message: Rafael J. Wysocki: "Re: [PATCH][Fix][Resend] Fix Bug #4959: Page tables corrupted during resume on x86-64 (take 3)"
    Date:	Thu, 29 Sep 2005 15:01:55 -0700
    To: akpm@osdl.org
    
    

            [PATCH]: Try to service a order 0 page request in __alloc_pages from the pcp list before checking the aone_watermarks.

            Try to service a order 0 page request from pcp list. This will allow us to not check and possibly start the reclaim activity when there are free pages present on the pcp. This early allocation does not try to replenish an empty pcp.

            Signed-off-by: Rohit Seth <rohit.seth@intel.com>

    --- linux-2.6.14-rc2-mm1.org/mm/page_alloc.c 2005-09-27 10:03:51.000000000 -0700
    +++ linux-2.6.14-rc2-mm1/mm/page_alloc.c 2005-09-28 17:38:15.000000000 -0700
    @@ -716,6 +716,39 @@
                     clear_highpage(page + i);
     }
     
    +/* 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;
    +}
    +
     /*
      * Really, prep_compound_page() should be called from __rmqueue_bulk(). But
      * we cheat by calling it from here, in the order > 0 path. Saves a branch
    @@ -905,6 +938,12 @@
                     if (!cpuset_zone_allowed(z, __GFP_HARDWALL))
                             continue;
     
    + if (order == 0) {
    + page = remove_from_pcp(z, gfp_mask);
    + if (page)
    + goto got_pg;
    + }
    +
                     /*
                      * If the zone is to attempt early page reclaim then this loop
                      * will try to reclaim pages and check the watermark a second
    -
    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/


  • Next message: Rafael J. Wysocki: "Re: [PATCH][Fix][Resend] Fix Bug #4959: Page tables corrupted during resume on x86-64 (take 3)"

    Relevant Pages

    • Re: [Jackit-devel] Re: [patch] voluntary-preempt-2.6.8-rc2-M5
      ... > to pollbefore entering the polling loop, by which time there has been ... internally calls malloc*after* calling snd_pcm_start. ... There's probably nothing to prevent us moving the freeand malloc() ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • kernel panic after sema_init(&sem,-1) why?
      ... if I initialise the semaphore to -1 ... then try to acquire it by calling down. ... privileged information for the sole use of the person or entity to ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] Add TPM hardware enablement driver
      ... Thanks for the helpful comments I am working on a patch to fix your ... When calling mod_timer and an occasional del_singleshot_timer_sync is it ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [patch 2.6.13-rc4] fix get_user_pages bug
      ... > Since we will have dropped the page table lock when calling ... I don't think we can fix that race (which is probably pretty much ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.7-rc3: waiting for eth0 to become free
      ... |>but not cleaning up (calling dev_put). ... could help for my error message too: ... Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)