From: Peter Zijlstra <peterz@infradead.org>
To: Nick Piggin <npiggin@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, davem@davemloft.net,
Trond Myklebust <trond.myklebust@fys.uio.no>
Subject: Re: [patch] nfs: use GFP_NOFS preloads for radix-tree insertion
Date: Tue, 13 Nov 2007 11:55:45 +0100 [thread overview]
Message-ID: <1194951345.6983.24.camel@twins> (raw)
In-Reply-To: <20071108065633.GB28216@wotan.suse.de>
On Thu, 2007-11-08 at 07:56 +0100, Nick Piggin wrote:
> Here is the NFS version. I guess Trond should ack it before you pick it
> up.
>
> --
>
> NFS should use GFP_NOFS mode radix tree preloads rather than GFP_ATOMIC
> allocations at radix-tree insertion-time. This is important to reduce the
> atomic memory requirement.
In another mail you said:
> Anyway we can also simplify the code because the insertion can't fail with a
> preload.
Can we please avoid adding strict dependencies on that as the preload
API is unsupportable in -rt.
> Signed-off-by: Nick Piggin <npiggin@suse.de>
> ---
> Index: linux-2.6/fs/nfs/write.c
> ===================================================================
> --- linux-2.6.orig/fs/nfs/write.c
> +++ linux-2.6/fs/nfs/write.c
> @@ -363,15 +363,13 @@ int nfs_writepages(struct address_space
> /*
> * Insert a write request into an inode
> */
> -static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
> +static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
> {
> struct nfs_inode *nfsi = NFS_I(inode);
> int error;
>
> error = radix_tree_insert(&nfsi->nfs_page_tree, req->wb_index, req);
> - BUG_ON(error == -EEXIST);
> - if (error)
> - return error;
> + BUG_ON(error);
> if (!nfsi->npages) {
> igrab(inode);
> if (nfs_have_delegation(inode, FMODE_WRITE))
> @@ -381,7 +379,6 @@ static int nfs_inode_add_request(struct
> set_page_private(req->wb_page, (unsigned long)req);
> nfsi->npages++;
> kref_get(&req->wb_kref);
> - return 0;
> }
>
> /*
> @@ -593,6 +590,13 @@ static struct nfs_page * nfs_update_requ
> /* Loop over all inode entries and see if we find
> * A request for the page we wish to update
> */
> + if (new) {
> + if (radix_tree_preload(GFP_NOFS)) {
> + nfs_release_request(new);
> + return ERR_PTR(-ENOMEM);
> + }
> + }
> +
> spin_lock(&inode->i_lock);
> req = nfs_page_find_request_locked(page);
> if (req) {
> @@ -603,28 +607,27 @@ static struct nfs_page * nfs_update_requ
> error = nfs_wait_on_request(req);
> nfs_release_request(req);
> if (error < 0) {
> - if (new)
> + if (new) {
> + radix_tree_preload_end();
> nfs_release_request(new);
> + }
> return ERR_PTR(error);
> }
> continue;
> }
> spin_unlock(&inode->i_lock);
> - if (new)
> + if (new) {
> + radix_tree_preload_end();
> nfs_release_request(new);
> + }
> break;
> }
>
> if (new) {
> - int error;
> nfs_lock_request_dontget(new);
> - error = nfs_inode_add_request(inode, new);
> - if (error) {
> - spin_unlock(&inode->i_lock);
> - nfs_unlock_request(new);
> - return ERR_PTR(error);
> - }
> + nfs_inode_add_request(inode, new);
> spin_unlock(&inode->i_lock);
> + radix_tree_preload_end();
> req = new;
> goto zero_page;
> }
>
> --
> 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>
--
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:[~2007-11-13 10:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-08 0:43 [patch] radix-tree: avoid atomic allocations for preloaded insertions Nick Piggin
2007-11-08 1:09 ` Andrew Morton
2007-11-08 1:34 ` David Miller, Andrew Morton
2007-11-08 1:41 ` Andrew Morton
2007-11-08 1:45 ` David Miller, Andrew Morton
2007-11-08 1:37 ` Nick Piggin
2007-11-08 3:02 ` Andrew Morton
2007-11-08 3:16 ` Nick Piggin
2007-11-08 4:12 ` Andrew Morton
2007-11-08 4:54 ` Nick Piggin
2007-11-08 5:02 ` Andrew Morton
2007-11-08 5:44 ` Nick Piggin
2007-11-08 6:02 ` Andrew Morton
2007-11-08 6:54 ` Nick Piggin
2007-11-08 6:56 ` [patch] nfs: use GFP_NOFS preloads for radix-tree insertion Nick Piggin
2007-11-13 10:55 ` Peter Zijlstra [this message]
2007-11-14 4:20 ` Nick Piggin
2007-11-14 9:06 ` Peter Zijlstra
2007-11-14 15:39 ` Nick Piggin
2007-11-08 11:57 ` [patch] radix-tree: avoid atomic allocations for preloaded insertions Peter Zijlstra
2007-11-08 20:37 ` Nick Piggin
2007-11-08 20:47 ` Peter Zijlstra
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=1194951345.6983.24.camel@twins \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
--cc=trond.myklebust@fys.uio.no \
/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