Re: [PATCH 7/8] writeback: sync old inodes first in background writeback

Wu Fengguang
2010-07-23T08:33:22Z

Hi Mel,

On Thu, Jul 22, 2010 at 05:42:09PM +0800, Mel Gorman wrote:
> On Thu, Jul 22, 2010 at 04:52:10PM +0800, Wu Fengguang wrote:
> > > Some insight on how the other writeback changes that are being floated
> > > around might affect the number of dirty pages reclaim encounters would also
> > > be helpful.
> >
> > Here is an interesting related problem about the wait_on_page_writeback() call
> > inside shrink_page_list():
> >
> > http://lkml.org/lkml/2010/4/4/86

I guess you've got the answers from the above thread, anyway here is
the brief answers to your questions.

> >
> > The problem is, wait_on_page_writeback() is called too early in the
> > direct reclaim path, which blocks many random/unrelated processes when
> > some slow (USB stick) writeback is on the way.
> >
> > A simple dd can easily create a big range of dirty pages in the LRU
> > list. Therefore priority can easily go below (DEF_PRIORITY - 2) in a
> > typical desktop, which triggers the lumpy reclaim mode and hence
> > wait_on_page_writeback().
> >
>
> Lumpy reclaim is for high-order allocations. A simple dd should not be
> triggering it regularly unless there was a lot of forking going on at the
> same time.

dd could create the dirty file fast enough, so that no other processes
are injecting pages into the LRU lists besides dd itself. So it's
creating a large range of hard-to-reclaim LRU pages which will trigger
this code

+ else if (sc->order && priority < DEF_PRIORITY - 2)
+ lumpy_reclaim = 1;

> Also, how would a random or unrelated process get blocked on
> writeback unless they were also doing high-order allocations? What was the
> source of the high-order allocations?

sc->order is 1 on fork().

Thanks,
Fengguang