From: Andrew Morton on
On Sun, 11 Jul 2010 10:06:57 +0800
Wu Fengguang <fengguang.wu(a)intel.com> wrote:

>
> Signed-off-by: Richard Kennedy <richard(a)rsk.demon.co.uk>
> Signed-off-by: Wu Fengguang <fengguang.wu(a)intel.com>
> ---
> mm/page-writeback.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> --- linux-next.orig/mm/page-writeback.c 2010-07-11 08:41:37.000000000 +0800
> +++ linux-next/mm/page-writeback.c 2010-07-11 08:42:14.000000000 +0800
> @@ -503,11 +503,12 @@ static void balance_dirty_pages(struct a
> };
>
> get_dirty_limits(&background_thresh, &dirty_thresh,
> - &bdi_thresh, bdi);
> + &bdi_thresh, bdi);
>
> nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
> - global_page_state(NR_UNSTABLE_NFS);
> - nr_writeback = global_page_state(NR_WRITEBACK);
> + global_page_state(NR_UNSTABLE_NFS);
> + nr_writeback = global_page_state(NR_WRITEBACK) +
> + global_page_state(NR_WRITEBACK_TEMP);
>
> bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
> bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
>

hm, OK.

I wonder whether we could/should have unified NR_WRITEBACK_TEMP and
NR_UNSTABLE_NFS. Their "meanings" aren't quite the same, but perhaps
some "treat page as dirty because the fs is futzing with it" thing.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Miklos Szeredi on
On Mon, 12 Jul 2010, Andrew Morton wrote:
> On Sun, 11 Jul 2010 10:06:57 +0800
> Wu Fengguang <fengguang.wu(a)intel.com> wrote:
>
> >
> > Signed-off-by: Richard Kennedy <richard(a)rsk.demon.co.uk>
> > Signed-off-by: Wu Fengguang <fengguang.wu(a)intel.com>
> > ---
> > mm/page-writeback.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > --- linux-next.orig/mm/page-writeback.c 2010-07-11 08:41:37.000000000 +0800
> > +++ linux-next/mm/page-writeback.c 2010-07-11 08:42:14.000000000 +0800
> > @@ -503,11 +503,12 @@ static void balance_dirty_pages(struct a
> > };
> >
> > get_dirty_limits(&background_thresh, &dirty_thresh,
> > - &bdi_thresh, bdi);
> > + &bdi_thresh, bdi);
> >
> > nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
> > - global_page_state(NR_UNSTABLE_NFS);
> > - nr_writeback = global_page_state(NR_WRITEBACK);
> > + global_page_state(NR_UNSTABLE_NFS);
> > + nr_writeback = global_page_state(NR_WRITEBACK) +
> > + global_page_state(NR_WRITEBACK_TEMP);
> >
> > bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
> > bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
> >
>
> hm, OK.

Hm, hm. I'm not sure this is right. The VM has absolutely no control
over NR_WRITEBACK_TEMP pages, they may clear quickly or may not make
any progress. So it's usually wrong to make a decision based on
NR_WRITEBACK_TEMP for an unrelated device.

Using it in throttle_vm_writeout() would actually be deadlocky, since
the userspace filesystem will probably depend on memory allocations to
complete the writeout.

The only place where we should be taking NR_WRITEBACK_TEMP into
account is calculating the remaining memory that can be devided
between dirtyers, and that's (clip_bdi_dirty_limit) where it is
already used.

> I wonder whether we could/should have unified NR_WRITEBACK_TEMP and
> NR_UNSTABLE_NFS. Their "meanings" aren't quite the same, but perhaps
> some "treat page as dirty because the fs is futzing with it" thing.

AFAICS NR_UNSTABLE_NFS is something akin to NR_DIRTY, only on the
server side. So nfs can very much do something about making
NR_UNSTABLE_NFS go away, while there's nothing that can be done about
NR_WRITEBACK_TEMP.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Wu Fengguang on
On Tue, Jul 13, 2010 at 04:58:47PM +0800, Miklos Szeredi wrote:
> On Mon, 12 Jul 2010, Andrew Morton wrote:
> > On Sun, 11 Jul 2010 10:06:57 +0800
> > Wu Fengguang <fengguang.wu(a)intel.com> wrote:
> >
> > >
> > > Signed-off-by: Richard Kennedy <richard(a)rsk.demon.co.uk>
> > > Signed-off-by: Wu Fengguang <fengguang.wu(a)intel.com>
> > > ---
> > > mm/page-writeback.c | 7 ++++---
> > > 1 file changed, 4 insertions(+), 3 deletions(-)
> > >
> > > --- linux-next.orig/mm/page-writeback.c 2010-07-11 08:41:37.000000000 +0800
> > > +++ linux-next/mm/page-writeback.c 2010-07-11 08:42:14.000000000 +0800
> > > @@ -503,11 +503,12 @@ static void balance_dirty_pages(struct a
> > > };
> > >
> > > get_dirty_limits(&background_thresh, &dirty_thresh,
> > > - &bdi_thresh, bdi);
> > > + &bdi_thresh, bdi);
> > >
> > > nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
> > > - global_page_state(NR_UNSTABLE_NFS);
> > > - nr_writeback = global_page_state(NR_WRITEBACK);
> > > + global_page_state(NR_UNSTABLE_NFS);
> > > + nr_writeback = global_page_state(NR_WRITEBACK) +
> > > + global_page_state(NR_WRITEBACK_TEMP);
> > >
> > > bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
> > > bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
> > >
> >
> > hm, OK.
>
> Hm, hm. I'm not sure this is right. The VM has absolutely no control
> over NR_WRITEBACK_TEMP pages, they may clear quickly or may not make
> any progress. So it's usually wrong to make a decision based on
> NR_WRITEBACK_TEMP for an unrelated device.

Ah OK, let's remove this patch.

> Using it in throttle_vm_writeout() would actually be deadlocky, since
> the userspace filesystem will probably depend on memory allocations to
> complete the writeout.

Right.

> The only place where we should be taking NR_WRITEBACK_TEMP into
> account is calculating the remaining memory that can be devided
> between dirtyers, and that's (clip_bdi_dirty_limit) where it is
> already used.

clip_bdi_dirty_limit() is removed in the next patch, hopefully it's OK.

> > I wonder whether we could/should have unified NR_WRITEBACK_TEMP and
> > NR_UNSTABLE_NFS. Their "meanings" aren't quite the same, but perhaps
> > some "treat page as dirty because the fs is futzing with it" thing.
>
> AFAICS NR_UNSTABLE_NFS is something akin to NR_DIRTY, only on the
> server side. So nfs can very much do something about making
> NR_UNSTABLE_NFS go away, while there's nothing that can be done about
> NR_WRITEBACK_TEMP.

Right. nfs_write_inode() normally tries to commit unstable pages.

Thanks,
Fengguang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/