diff options
-rw-r--r-- | mm/page_alloc.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 845b91749a42..3c5cf664abd2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2397,13 +2397,18 @@ void setup_per_zone_pages_min(void) | |||
2397 | } | 2397 | } |
2398 | 2398 | ||
2399 | for_each_zone(zone) { | 2399 | for_each_zone(zone) { |
2400 | unsigned long tmp; | ||
2400 | spin_lock_irqsave(&zone->lru_lock, flags); | 2401 | spin_lock_irqsave(&zone->lru_lock, flags); |
2402 | tmp = (pages_min * zone->present_pages) / lowmem_pages; | ||
2401 | if (is_highmem(zone)) { | 2403 | if (is_highmem(zone)) { |
2402 | /* | 2404 | /* |
2403 | * Often, highmem doesn't need to reserve any pages. | 2405 | * __GFP_HIGH and PF_MEMALLOC allocations usually don't |
2404 | * But the pages_min/low/high values are also used for | 2406 | * need highmem pages, so cap pages_min to a small |
2405 | * batching up page reclaim activity so we need a | 2407 | * value here. |
2406 | * decent value here. | 2408 | * |
2409 | * The (pages_high-pages_low) and (pages_low-pages_min) | ||
2410 | * deltas controls asynch page reclaim, and so should | ||
2411 | * not be capped for highmem. | ||
2407 | */ | 2412 | */ |
2408 | int min_pages; | 2413 | int min_pages; |
2409 | 2414 | ||
@@ -2414,19 +2419,15 @@ void setup_per_zone_pages_min(void) | |||
2414 | min_pages = 128; | 2419 | min_pages = 128; |
2415 | zone->pages_min = min_pages; | 2420 | zone->pages_min = min_pages; |
2416 | } else { | 2421 | } else { |
2417 | /* if it's a lowmem zone, reserve a number of pages | 2422 | /* |
2423 | * If it's a lowmem zone, reserve a number of pages | ||
2418 | * proportionate to the zone's size. | 2424 | * proportionate to the zone's size. |
2419 | */ | 2425 | */ |
2420 | zone->pages_min = (pages_min * zone->present_pages) / | 2426 | zone->pages_min = tmp; |
2421 | lowmem_pages; | ||
2422 | } | 2427 | } |
2423 | 2428 | ||
2424 | /* | 2429 | zone->pages_low = zone->pages_min + tmp / 4; |
2425 | * When interpreting these watermarks, just keep in mind that: | 2430 | zone->pages_high = zone->pages_min + tmp / 2; |
2426 | * zone->pages_min == (zone->pages_min * 4) / 4; | ||
2427 | */ | ||
2428 | zone->pages_low = (zone->pages_min * 5) / 4; | ||
2429 | zone->pages_high = (zone->pages_min * 6) / 4; | ||
2430 | spin_unlock_irqrestore(&zone->lru_lock, flags); | 2431 | spin_unlock_irqrestore(&zone->lru_lock, flags); |
2431 | } | 2432 | } |
2432 | } | 2433 | } |