Re: Software suspend testing in 2.6.0-test1

Andrew Morton
2003-07-17T20:02:07Z

Pavel Machek <pavel@ucw.cz> wrote:
>
> > --- linux/mm/vmscan.c.old Thu Jul 17 21:30:09 2003
> > +++ linux/mm/vmscan.c Thu Jul 17 21:29:58 2003
> > @@ -930,7 +930,7 @@
> > }
> > if (all_zones_ok)
> > break;
> > - blk_congestion_wait(WRITE, HZ/10);
> > + blk_congestion_wait(WRITE, HZ/50);
> > }
> > return nr_pages - to_free;
> > }
>
> This is certainly not okay. Andrew, you know more about vm
> internals... What does this ugly constant mean?

Most of the time the timeout is a "can't happen" - blk_congestion_wait() is
terminated by completion of writeout. The timeout is mainly there to
prevent hangs if weird and rare races happen. Otherwise we'd need lots
more locking.

I don't think we want to be calling it at all if reclaim is working well.
Something like this.

diff -puN mm/vmscan.c~a mm/vmscan.c
--- 25/mm/vmscan.c~a Thu Jul 17 13:05:36 2003
+++ 25-akpm/mm/vmscan.c Thu Jul 17 13:05:58 2003
@@ -921,7 +921,7 @@ static int balance_pgdat(pg_data_t *pgda
if (i < ZONE_HIGHMEM) {
reclaim_state->reclaimed_slab = 0;
shrink_slab(max_scan + nr_mapped, GFP_KERNEL);
- to_free += reclaim_state->reclaimed_slab;
+ to_free -= reclaim_state->reclaimed_slab;
}
if (zone->all_unreclaimable)
continue;
@@ -930,7 +930,8 @@ static int balance_pgdat(pg_data_t *pgda
}
if (all_zones_ok)
break;
- blk_congestion_wait(WRITE, HZ/10);
+ if (to_free)
+ blk_congestion_wait(WRITE, HZ/10);
}
return nr_pages - to_free;
}

_