lkml.org 
[lkml]   [2009]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 20/22] vmscan: avoid multiplication overflow in shrink_zone()
On Fri, May 01, 2009 at 06:08:55AM +0800, Andrew Morton wrote:
>
> Local variable `scan' can overflow on zones which are larger than
>
> (2G * 4k) / 100 = 80GB.
>
> Making it 64-bit on 64-bit will fix that up.

A side note about the "one HUGE scan inside shrink_zone":

Isn't this low level scan granularity way tooooo large?
It makes things a lot worse on memory pressure:
- the over reclaim, somehow workarounded by Rik's early bail out patch
- the throttle_vm_writeout()/congestion_wait() guards could work in a
very sparse manner and hence is useless: imagine to stop and wait
after shooting away every 1GB memory.

The long term fix could be to move the granularity control up to the
shrink_zones() level: there it can bail out early without hurting the
balanced zone aging.

Thanks,
Fengguang

> --- a/mm/vmscan.c~vmscan-avoid-multiplication-overflow-in-shrink_zone
> +++ a/mm/vmscan.c
> @@ -1471,7 +1471,7 @@ static void shrink_zone(int priority, st
>
> for_each_evictable_lru(l) {
> int file = is_file_lru(l);
> - int scan;
> + unsigned long scan;
>
> scan = zone_nr_pages(zone, sc, l);
> if (priority) {
> _


\
 
 \ /
  Last update: 2009-05-01 03:25    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site