From: Mel Gorman <mgorman@suse.de>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: trond.myklebust@primarydata.com, linux-nfs@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Jerome Marchand <jmarchan@redhat.com>
Subject: Re: [PATCH 1/4] sunrpc: keep a count of swapfiles associated with the rpc_clnt
Date: Tue, 2 Jun 2015 13:36:23 +0100 [thread overview]
Message-ID: <20150602123623.GE26425@suse.de> (raw)
In-Reply-To: <1432987393-15604-2-git-send-email-jeff.layton@primarydata.com>
On Sat, May 30, 2015 at 08:03:10AM -0400, Jeff Layton wrote:
> Jerome reported seeing a warning pop when working with a swapfile on
> NFS. The nfs_swap_activate can end up calling sk_set_memalloc while
> holding the rcu_read_lock and that function can sleep.
>
> To fix that, we need to take a reference to the xprt while holding the
> rcu_read_lock, set the socket up for swapping and then drop that
> reference. But, xprt_put is not exported and having NFS deal with the
> underlying xprt is a bit of layering violation anyway.
>
> Fix this by adding a set of activate/deactivate functions that take a
> rpc_clnt pointer instead of an rpc_xprt, and have nfs_swap_activate and
> nfs_swap_deactivate call those.
>
> Also, add a per-rpc_clnt atomic counter to keep track of the number of
> active swapfiles associated with it. When the counter does a 0->1
> transition, we enable swapping on the xprt, when we do a 1->0 transition
> we disable swapping on it.
>
> This also allows us to be a bit more selective with the RPC_TASK_SWAPPER
> flag. If non-swapper and swapper clnts are sharing a xprt, then we only
> need to flag the tasks from the swapper clnt with that flag.
>
> Cc: Mel Gorman <mgorman@suse.de>
> Reported-by: Jerome Marchand <jmarchan@redhat.com>
> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Acked-by: Mel Gorman <mgorman@suse.de>
--
Mel Gorman
SUSE Labs
WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mgorman@suse.de>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: trond.myklebust@primarydata.com, linux-nfs@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Jerome Marchand <jmarchan@redhat.com>
Subject: Re: [PATCH 1/4] sunrpc: keep a count of swapfiles associated with the rpc_clnt
Date: Tue, 2 Jun 2015 13:36:23 +0100 [thread overview]
Message-ID: <20150602123623.GE26425@suse.de> (raw)
In-Reply-To: <1432987393-15604-2-git-send-email-jeff.layton@primarydata.com>
On Sat, May 30, 2015 at 08:03:10AM -0400, Jeff Layton wrote:
> Jerome reported seeing a warning pop when working with a swapfile on
> NFS. The nfs_swap_activate can end up calling sk_set_memalloc while
> holding the rcu_read_lock and that function can sleep.
>
> To fix that, we need to take a reference to the xprt while holding the
> rcu_read_lock, set the socket up for swapping and then drop that
> reference. But, xprt_put is not exported and having NFS deal with the
> underlying xprt is a bit of layering violation anyway.
>
> Fix this by adding a set of activate/deactivate functions that take a
> rpc_clnt pointer instead of an rpc_xprt, and have nfs_swap_activate and
> nfs_swap_deactivate call those.
>
> Also, add a per-rpc_clnt atomic counter to keep track of the number of
> active swapfiles associated with it. When the counter does a 0->1
> transition, we enable swapping on the xprt, when we do a 1->0 transition
> we disable swapping on it.
>
> This also allows us to be a bit more selective with the RPC_TASK_SWAPPER
> flag. If non-swapper and swapper clnts are sharing a xprt, then we only
> need to flag the tasks from the swapper clnt with that flag.
>
> Cc: Mel Gorman <mgorman@suse.de>
> Reported-by: Jerome Marchand <jmarchan@redhat.com>
> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Acked-by: Mel Gorman <mgorman@suse.de>
--
Mel Gorman
SUSE Labs
--
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:[~2015-06-02 12:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-30 12:03 [PATCH 0/4] sunrpc: clean up "swapper" xprt handling Jeff Layton
2015-05-30 12:03 ` Jeff Layton
2015-05-30 12:03 ` [PATCH 1/4] sunrpc: keep a count of swapfiles associated with the rpc_clnt Jeff Layton
2015-05-30 12:03 ` Jeff Layton
2015-06-02 12:36 ` Mel Gorman [this message]
2015-06-02 12:36 ` Mel Gorman
2015-05-30 12:03 ` [PATCH 2/4] sunrpc: make xprt->swapper an atomic_t Jeff Layton
2015-05-30 12:03 ` Jeff Layton
2015-05-30 17:55 ` Chuck Lever
2015-05-30 17:55 ` Chuck Lever
2015-05-30 19:38 ` Jeff Layton
2015-05-30 19:38 ` Jeff Layton
2015-05-30 12:03 ` [PATCH 3/4] sunrpc: if we're closing down a socket, clear memalloc on it first Jeff Layton
2015-05-30 12:03 ` Jeff Layton
2015-06-02 12:38 ` Mel Gorman
2015-06-02 12:38 ` Mel Gorman
2015-06-02 12:40 ` Mel Gorman
2015-06-02 12:40 ` Mel Gorman
2015-06-03 14:32 ` Jeff Layton
2015-06-03 14:32 ` Jeff Layton
2015-06-04 13:08 ` Mel Gorman
2015-06-04 13:08 ` Mel Gorman
2015-06-04 14:25 ` Jeff Layton
2015-06-04 14:25 ` Jeff Layton
2015-05-30 12:03 ` [PATCH 4/4] sunrpc: lock xprt before trying to set memalloc on the sockets Jeff Layton
2015-05-30 12:03 ` Jeff Layton
2015-05-30 12:57 ` Jeff Layton
2015-05-30 12:57 ` Jeff Layton
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=20150602123623.GE26425@suse.de \
--to=mgorman@suse.de \
--cc=jlayton@poochiereds.net \
--cc=jmarchan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.