Commit 669ed175 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds

[PATCH] mm: highmem watermarks

The pages_high - pages_low and pages_low - pages_min deltas are the asynch
reclaim watermarks.  As such, the should be in the same ratios as any other
zone for highmem zones.  It is the pages_min - 0 delta which is the
PF_MEMALLOC reserve, and this is the region that isn't very useful for
highmem.

This patch ensures highmem systems have similar characteristics as non highmem
ones with the same amount of memory, and also that highmem zones get similar
reclaim pressures to other zones.
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2d6c666e
...@@ -2397,13 +2397,18 @@ void setup_per_zone_pages_min(void) ...@@ -2397,13 +2397,18 @@ void setup_per_zone_pages_min(void)
} }
for_each_zone(zone) { for_each_zone(zone) {
unsigned long tmp;
spin_lock_irqsave(&zone->lru_lock, flags); spin_lock_irqsave(&zone->lru_lock, flags);
tmp = (pages_min * zone->present_pages) / lowmem_pages;
if (is_highmem(zone)) { if (is_highmem(zone)) {
/* /*
* Often, highmem doesn't need to reserve any pages. * __GFP_HIGH and PF_MEMALLOC allocations usually don't
* But the pages_min/low/high values are also used for * need highmem pages, so cap pages_min to a small
* batching up page reclaim activity so we need a * value here.
* decent value here. *
* The (pages_high-pages_low) and (pages_low-pages_min)
* deltas controls asynch page reclaim, and so should
* not be capped for highmem.
*/ */
int min_pages; int min_pages;
...@@ -2414,19 +2419,15 @@ void setup_per_zone_pages_min(void) ...@@ -2414,19 +2419,15 @@ void setup_per_zone_pages_min(void)
min_pages = 128; min_pages = 128;
zone->pages_min = min_pages; zone->pages_min = min_pages;
} else { } else {
/* if it's a lowmem zone, reserve a number of pages /*
* If it's a lowmem zone, reserve a number of pages
* proportionate to the zone's size. * proportionate to the zone's size.
*/ */
zone->pages_min = (pages_min * zone->present_pages) / zone->pages_min = tmp;
lowmem_pages;
} }
/* zone->pages_low = zone->pages_min + tmp / 4;
* When interpreting these watermarks, just keep in mind that: zone->pages_high = zone->pages_min + tmp / 2;
* zone->pages_min == (zone->pages_min * 4) / 4;
*/
zone->pages_low = (zone->pages_min * 5) / 4;
zone->pages_high = (zone->pages_min * 6) / 4;
spin_unlock_irqrestore(&zone->lru_lock, flags); spin_unlock_irqrestore(&zone->lru_lock, flags);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment