Re: [PATCH 1/2] mm: page allocator: Initialise ZLC for first zoneeligible for zone_reclaim

From: Christoph Lameter
Date: Wed Jul 20 2011 - 17:17:49 EST

Hmmm... Maybe we can bypass the checks?

Subject: [page allocator] Do not check watermarks if there is a page available on the per cpu freelists

One should be able to grab a page from the per cpu freelists if available.
The pages on the per cpu freelists are not accounted for in VM statistics
so getting a page from there has no impact on reclaim.

Check for this condition in get_page_from_freelist and short circuit
to the call to buffered_rmqueue if so.

Note that there is a race here. We may deplete the reserve pools by
one page if either the process is rescheduled on a different processor
or if another process grabs the last page from the per cpu freelist.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>

mm/page_alloc.c | 10 ++++++++++
1 file changed, 10 insertions(+)

Index: linux-2.6/mm/page_alloc.c
--- linux-2.6.orig/mm/page_alloc.c 2011-07-20 15:27:20.544825852 -0500
+++ linux-2.6/mm/page_alloc.c 2011-07-20 15:30:05.314824797 -0500
@@ -1666,6 +1666,16 @@ zonelist_scan:
!cpuset_zone_allowed_softwall(zone, gfp_mask))
goto try_next_zone;

+ /*
+ * Short circuit allocation if we have a usable object on
+ * the percpu freelist. Note that this can only be an
+ * optimization since there is no guarantee that we will
+ * be executing on the same cpu. Another process could also
+ * be scheduled and take the available page from us.
+ */
+ if (order == 0 && this_cpu_read(zone->pageset->pcp.count))
+ goto try_this_zone;
if (!(alloc_flags & ALLOC_NO_WATERMARKS)) {
unsigned long mark;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at