From: "Seth, Rohit" <rohit.seth@intel.com>
To: akpm@osdl.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] earlier allocation of order 0 pages from pcp in __alloc_pages
Date: Thu, 29 Sep 2005 15:01:55 -0700 [thread overview]
Message-ID: <20050929150155.A15646@unix-os.sc.intel.com> (raw)
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, 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>
next reply other threads:[~2005-09-29 22:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-29 22:01 Seth, Rohit [this message]
2005-09-29 22:36 ` Andrew Morton
2005-09-30 1:05 ` Rohit Seth
2005-09-29 22:48 ` Martin J. Bligh
2005-09-29 23:11 ` Andrew Morton
2005-09-30 1:58 ` Rohit Seth
2005-09-30 12:30 ` Martin Hicks
2005-09-30 1:32 ` Rohit Seth
2005-09-30 1:32 ` Martin J. Bligh
2005-09-29 22:50 ` Dave Hansen
2005-09-30 1:10 ` Rohit Seth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050929150155.A15646@unix-os.sc.intel.com \
--to=rohit.seth@intel.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox