Re: [PATCH 8/8] vmscan: Kick flusher threads to clean pages when reclaim is encountering dirty pages

Johannes Weiner
2010-07-20T22:05:58Z

On Tue, Jul 20, 2010 at 03:10:49PM +0100, Mel Gorman wrote:
> On Tue, Jul 20, 2010 at 12:48:39AM +0200, Johannes Weiner wrote:
> > On Mon, Jul 19, 2010 at 03:37:37PM +0100, Mel Gorman wrote:
> > > although the latter can get disabled too. Deleting the magic is an
> > > option which would trade IO efficiency for power efficiency but my
> > > current thinking is laptop mode preferred reduced power.
> >
> > Maybe couple your wakeup with sc->may_writepage? It is usually false
> > for laptop_mode but direct reclaimers enable it at one point in
> > do_try_to_free_pages() when it scanned more than 150% of the reclaim
> > target, so you could use existing disk spin-up points instead of
> > introducing new ones or disabling the heuristics in laptop mode.
> >
>
> How about the following?
>
> if (nr_dirty && sc->may_writepage)
> wakeup_flusher_threads(laptop_mode ? 0 :
> nr_dirty + nr_dirty / 2);
>
>
> 1. Wakup flusher threads if dirty pages are encountered
> 2. For direct reclaim, only wake them up if may_writepage is set
> indicating that the system is ready to spin up disks and start
> reclaiming
> 3. In laptop_mode, flush everything to reduce future spin-ups

Sounds like the sanest approach to me. Thanks.

Hannes