From: Nick Piggin <npiggin@suse.de>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH 05/13] VM/NFS: The VM must tell the filesystem when to free reclaimable pages
Date: Mon, 15 Feb 2010 16:55:33 +1100 [thread overview]
Message-ID: <20100215055533.GF5723@laptop> (raw)
In-Reply-To: <1265821413-21618-6-git-send-email-Trond.Myklebust@netapp.com>
On Wed, Feb 10, 2010 at 12:03:25PM -0500, Trond Myklebust wrote:
> balance_dirty_pages() should really tell the filesystem whether or not it
> has an excess of actual dirty pages, or whether it would be more useful to
> start freeing up the unstable writes.
>
> Assume that if the number of unstable writes is more than 1/2 the number of
> reclaimable pages, then we should force NFS to free up the former.
>
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> Acked-by: Jan Kara <jack@suse.cz>
> Acked-by: Peter Zijlstra <peterz@infradead.org>
> ---
> fs/nfs/write.c | 2 +-
> include/linux/writeback.h | 5 +++++
> mm/page-writeback.c | 12 ++++++++++--
> 3 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> index ed032c0..2f1d9a6 100644
> --- a/fs/nfs/write.c
> +++ b/fs/nfs/write.c
> @@ -1415,7 +1415,7 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr
> /* Don't commit yet if this is a non-blocking flush and there are
> * outstanding writes for this mapping.
> */
> - if (wbc->sync_mode != WB_SYNC_ALL &&
> + if (!wbc->force_commit_unstable && wbc->sync_mode != WB_SYNC_ALL &&
> radix_tree_tagged(&NFS_I(inode)->nfs_page_tree,
> NFS_PAGE_TAG_LOCKED))
> goto out_mark_dirty;
> diff --git a/include/linux/writeback.h b/include/linux/writeback.h
> index 76e8903..8229139 100644
> --- a/include/linux/writeback.h
> +++ b/include/linux/writeback.h
> @@ -62,6 +62,11 @@ struct writeback_control {
> * so we use a single control to update them
> */
> unsigned no_nrwrite_index_update:1;
> + /*
> + * The following is used by balance_dirty_pages() to
> + * force NFS to commit unstable pages.
> + */
> + unsigned force_commit_unstable:1;
> };
>
> /*
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index c06739b..6a0aec7 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -503,6 +503,7 @@ static void balance_dirty_pages(struct address_space *mapping,
> .nr_to_write = write_chunk,
> .range_cyclic = 1,
> };
> + long bdi_nr_unstable = 0;
>
> get_dirty_limits(&background_thresh, &dirty_thresh,
> &bdi_thresh, bdi);
> @@ -512,8 +513,10 @@ static void balance_dirty_pages(struct address_space *mapping,
> nr_writeback = global_page_state(NR_WRITEBACK);
>
> bdi_nr_reclaimable = bdi_stat(bdi, BDI_DIRTY);
> - if (bdi_cap_account_unstable(bdi))
> - bdi_nr_reclaimable += bdi_stat(bdi, BDI_UNSTABLE);
> + if (bdi_cap_account_unstable(bdi)) {
> + bdi_nr_unstable = bdi_stat(bdi, BDI_UNSTABLE);
> + bdi_nr_reclaimable += bdi_nr_unstable;
> + }
> bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
>
> if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
> @@ -541,6 +544,11 @@ static void balance_dirty_pages(struct address_space *mapping,
> * up.
> */
> if (bdi_nr_reclaimable > bdi_thresh) {
> + wbc.force_commit_unstable = 0;
> + /* Force NFS to also free up unstable writes. */
> + if (bdi_nr_unstable > bdi_nr_reclaimable / 2)
> + wbc.force_commit_unstable = 1;
This seems like it is putting NFS specific logic into the VM. OK,
we already have it because we have these unstable pages, but all
we really cared about before is that dirty+unstable ~= reclaimable.
Shouldn't NFS just work out its ratio of dirty and unstable pages
and just do the right thing in its writeback path?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-02-15 5:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-10 17:03 [PATCH 00/13] Allow the VM to manage NFS unstable writes Trond Myklebust
2010-02-10 17:03 ` [PATCH 01/13] VM: Split out the accounting of unstable writes from BDI_RECLAIMABLE Trond Myklebust
2010-02-10 17:03 ` [PATCH 02/13] VM: Don't call bdi_stat(BDI_UNSTABLE) on non-nfs backing-devices Trond Myklebust
2010-02-10 17:03 ` [PATCH 03/13] NFS: Cleanup - move nfs_write_inode() into fs/nfs/write.c Trond Myklebust
2010-02-10 17:03 ` [PATCH 04/13] NFS: Reduce the number of unnecessary COMMIT calls Trond Myklebust
2010-02-10 17:03 ` [PATCH 05/13] VM/NFS: The VM must tell the filesystem when to free reclaimable pages Trond Myklebust
2010-02-10 17:03 ` [PATCH 06/13] NFS: Run COMMIT as an asynchronous RPC call when wbc->for_background is set Trond Myklebust
2010-02-10 17:03 ` [PATCH 07/13] NFS: Ensure inode is always marked I_DIRTY_DATASYNC, if it has unstable pages Trond Myklebust
2010-02-10 17:03 ` [PATCH 08/13] NFS: Simplify nfs_wb_page_cancel() Trond Myklebust
2010-02-10 17:03 ` [PATCH 09/13] NFS: Replace __nfs_write_mapping with sync_inode() Trond Myklebust
2010-02-10 17:03 ` [PATCH 10/13] NFS: Simplify nfs_wb_page() Trond Myklebust
2010-02-10 17:03 ` [PATCH 11/13] NFS: Clean up nfs_sync_mapping Trond Myklebust
2010-02-10 17:03 ` [PATCH 12/13] NFS: Remove requirement for inode->i_mutex from nfs_invalidate_mapping Trond Myklebust
2010-02-10 17:03 ` [PATCH 13/13] NFS: Don't write out dirty pages in nfs_release_page() Trond Myklebust
2010-02-15 5:55 ` Nick Piggin [this message]
2010-02-15 17:09 ` [PATCH 05/13] VM/NFS: The VM must tell the filesystem when to free reclaimable pages Trond Myklebust
2010-02-15 17:51 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100215055533.GF5723@laptop \
--to=npiggin@suse.de \
--cc=Trond.Myklebust@netapp.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox